X-Git-Url: http://git.code-monkey.de/?p=umurmur.git;a=blobdiff_plain;f=src%2Fmessages.c;h=d99548563c042cb04e417930ece49d2a6cc9db59;hp=d661c9e356e674cdc1a69592179131c82b847ee6;hb=82bb2989ad3f139f7acb3bf91d471644cbb2a8d1;hpb=55689f8918dde299c47c06eee4b8eda4a1c9889e diff --git a/src/messages.c b/src/messages.c index d661c9e..d995485 100644 --- a/src/messages.c +++ b/src/messages.c @@ -267,9 +267,8 @@ int Msg_messageToNetwork(message_t *msg, uint8_t *buffer) static message_t *Msg_create_nopayload(messageType_t messageType) { - message_t *msg = Memory_safeMalloc(1, sizeof(message_t)); + message_t *msg = Memory_safeCalloc(1, sizeof(message_t)); - memset(msg, 0, sizeof(message_t)); msg->refcount = 1; msg->messageType = messageType; init_list_entry(&msg->node); @@ -382,14 +381,12 @@ message_t *Msg_banList_create(int n_bans) message_t *msg = Msg_create_nopayload(BanList); int i; - msg->payload.banList = Memory_safeMalloc(1, sizeof(MumbleProto__BanList)); - memset(msg->payload.banList, 0, sizeof(MumbleProto__BanList)); + msg->payload.banList = Memory_safeCalloc(1, sizeof(MumbleProto__BanList)); mumble_proto__ban_list__init(msg->payload.banList); msg->payload.banList->n_bans = n_bans; msg->payload.banList->bans = Memory_safeMalloc(1, sizeof(MumbleProto__BanList__BanEntry *) * n_bans); for (i = 0; i < n_bans; i++) { - msg->payload.banList->bans[i] = Memory_safeMalloc(1, sizeof(MumbleProto__BanList__BanEntry)); - memset(msg->payload.banList->bans[i], 0, sizeof(MumbleProto__BanList__BanEntry)); + msg->payload.banList->bans[i] = Memory_safeCalloc(1, sizeof(MumbleProto__BanList__BanEntry)); mumble_proto__ban_list__ban_entry__init(msg->payload.banList->bans[i]); } return msg;