Mercurial > pidgin
changeset 29714:ff8a91b1f795
Lots of little memleak fixes
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 12 Apr 2010 07:58:08 +0000 |
parents | 0fb628a28e5c |
children | 6e2a246a8d74 |
files | libpurple/protocols/simple/simple.c libpurple/protocols/simple/sipmsg.c |
diffstat | 2 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/simple/simple.c Mon Apr 12 07:13:52 2010 +0000 +++ b/libpurple/protocols/simple/simple.c Mon Apr 12 07:58:08 2010 +0000 @@ -1653,6 +1653,7 @@ } purple_debug(PURPLE_DEBUG_MISC, "simple", "in process response response: %d\n", msg->response); process_input_message(sip, msg); + sipmsg_free(msg); } else { purple_debug(PURPLE_DEBUG_MISC, "simple", "received a incomplete sip msg: %s\n", conn->inbuf); } @@ -1671,6 +1672,7 @@ purple_debug_info("simple", "\n\nreceived - %s\n######\n%s\n#######\n\n", ctime(&currtime), buffer); msg = sipmsg_parse_msg(buffer); if(msg) process_input_message(sip, msg); + sipmsg_free(msg); } } @@ -2021,6 +2023,9 @@ g_free(sip->proxy.target); g_free(sip->proxy.realm); g_free(sip->proxy.digest_session_key); + g_free(sip->status); + g_hash_table_destroy(sip->buddies); + g_free(sip->regcallid); g_free(sip->publish_etag); if (sip->txbuf) purple_circ_buffer_destroy(sip->txbuf);
--- a/libpurple/protocols/simple/sipmsg.c Mon Apr 12 07:13:52 2010 +0000 +++ b/libpurple/protocols/simple/sipmsg.c Mon Apr 12 07:58:08 2010 +0000 @@ -55,15 +55,15 @@ } struct sipmsg *sipmsg_parse_header(const gchar *header) { - struct sipmsg *msg = g_new0(struct sipmsg,1); - gchar **parts, **lines = g_strsplit(header,"\r\n",0); + struct sipmsg *msg; + gchar **parts, **lines; gchar *dummy, *dummy2, *tmp; const gchar *tmp2; int i = 1; + lines = g_strsplit(header,"\r\n",0); if(!lines[0]) { g_strfreev(lines); - g_free(msg); return NULL; } @@ -71,10 +71,10 @@ if(!parts[0] || !parts[1] || !parts[2]) { g_strfreev(parts); g_strfreev(lines); - g_free(msg); return NULL; } + msg = g_new0(struct sipmsg,1); if(strstr(parts[0],"SIP")) { /* numeric response */ msg->method = g_strdup(parts[2]); msg->response = strtol(parts[1],NULL,10); @@ -90,7 +90,7 @@ if(!parts[0] || !parts[1]) { g_strfreev(parts); g_strfreev(lines); - g_free(msg); + sipmsg_free(msg); return NULL; } dummy = parts[1]; @@ -106,6 +106,7 @@ dummy2 = tmp; } sipmsg_add_header(msg, parts[0], dummy2); + g_free(dummy2); g_strfreev(parts); } g_strfreev(lines); @@ -116,9 +117,10 @@ if(msg->response) { tmp2 = sipmsg_find_header(msg, "CSeq"); + g_free(msg->method); if(!tmp2) { /* SHOULD NOT HAPPEN */ - msg->method = 0; + msg->method = NULL; } else { parts = g_strsplit(tmp2, " ", 2); msg->method = g_strdup(parts[1]); @@ -168,7 +170,7 @@ return g_string_free(outstr, FALSE); } void sipmsg_add_header(struct sipmsg *msg, const gchar *name, const gchar *value) { - struct siphdrelement *element = g_new0(struct siphdrelement,1); + struct siphdrelement *element = g_new(struct siphdrelement,1); element->name = g_strdup(name); element->value = g_strdup(value); msg->headers = g_slist_append(msg->headers, element);