Mercurial > pidgin
diff libpurple/protocols/msn/msg.c @ 20989:2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 18 Oct 2007 23:51:10 +0000 |
parents | 1d9d5de48b9e |
children | c8f99cb61dc9 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c Thu Oct 18 21:00:06 2007 +0000 +++ b/libpurple/protocols/msn/msg.c Thu Oct 18 23:51:10 2007 +0000 @@ -313,6 +313,7 @@ /* Import the body. */ if (body_len > 0) { msg->body_len = body_len; + g_free(msg->body); msg->body = g_malloc0(msg->body_len + 1); memcpy(msg->body, tmp, msg->body_len); tmp += body_len; @@ -329,6 +330,7 @@ { if (payload_len - (tmp - tmp_base) > 0) { msg->body_len = payload_len - (tmp - tmp_base); + g_free(msg->body); msg->body = g_malloc0(msg->body_len + 1); memcpy(msg->body, tmp, msg->body_len); }