X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fmessages.c;h=7b99ce0c9e477ccc57bb20f23efcff4ae38d6f35;hb=a605362cab90bdc81604fee1cbcbfbfe7849935d;hp=109f5eb22af6c8844262678e5519e676ef78f73f;hpb=477a4a1b836a9693338dd2ef76782013f3fb0a16;p=umurmur.git diff --git a/src/messages.c b/src/messages.c index 109f5eb..7b99ce0 100644 --- a/src/messages.c +++ b/src/messages.c @@ -41,7 +41,6 @@ #define PREAMBLE_SIZE 6 -static void dumpmsg(uint8_t *data, int size); static message_t *Msg_create_nopayload(messageType_t messageType); static void Msg_addPreamble(uint8_t *buffer, uint16_t type, uint32_t len) @@ -436,8 +435,12 @@ void Msg_free(message_t *msg) if (msg->unpacked) mumble_proto__channel_state__free_unpacked(msg->payload.channelState, NULL); else { - free(msg->payload.channelState->name); - free(msg->payload.channelState->description); + if (msg->payload.channelState->name) + free(msg->payload.channelState->name); + if (msg->payload.channelState->description) + free(msg->payload.channelState->description); + if (msg->payload.channelState->links) + free(msg->payload.channelState->links); free(msg->payload.channelState); } break; @@ -484,23 +487,6 @@ void Msg_free(message_t *msg) free(msg); } -void dumpmsg(uint8_t *data, int size) -{ - int i, r = 0, offset = 0; - char buf[512]; - - while (r * 8 + i < size) { - for (i = 0; i < 8 && r * 8 + i < size; i++) { - offset += sprintf(buf + offset, "%x ", data[r * 8 + i]); - } - sprintf(buf + offset, "\n"); - printf(buf); - offset = 0; - r++; - i = 0; - } -} - message_t *Msg_CreateVoiceMsg(uint8_t *data, int size) { message_t *msg = NULL;