# HG changeset patch # User Paul Aurich # Date 1249189481 0 # Node ID da33da2e1a1eca83598bff05849658fb868ecbf8 # Parent c91832e94473b1e405f72466c0e8cf6397a2bc77 Fix a bunch of memory leaks reported by Josh Mueller. Refs #9822. diff -r c91832e94473 -r da33da2e1a1e ChangeLog --- a/ChangeLog Sun Aug 02 04:33:26 2009 +0000 +++ b/ChangeLog Sun Aug 02 05:04:41 2009 +0000 @@ -44,6 +44,7 @@ * Install scalable versions of the main Pidgin icon, the protocol icons, the dialog icons, and the Buddy List emblems. * Build properly on Hurd. (Marc Dequènes) + * Various memory leaks fixed as reported by Josh Mueller. AIM and ICQ: * Preliminary support for a new authentication scheme called diff -r c91832e94473 -r da33da2e1a1e libpurple/cipher.c --- a/libpurple/cipher.c Sun Aug 02 04:33:26 2009 +0000 +++ b/libpurple/cipher.c Sun Aug 02 05:04:41 2009 +0000 @@ -2727,8 +2727,6 @@ cipher = PURPLE_CIPHER(l->data); purple_ciphers_unregister_cipher(cipher); - - ciphers = g_list_remove(ciphers, cipher); } g_list_free(ciphers); diff -r c91832e94473 -r da33da2e1a1e libpurple/desktopitem.c --- a/libpurple/desktopitem.c Sun Aug 02 04:33:26 2009 +0000 +++ b/libpurple/desktopitem.c Sun Aug 02 05:04:41 2009 +0000 @@ -831,11 +831,10 @@ static char * try_english_key (PurpleDesktopItem *item, const char *key) { - char *str; + char *str = NULL; char *locales[] = { "en_US", "en_GB", "en_AU", "en", NULL }; int i; - str = NULL; for (i = 0; locales[i] != NULL && str == NULL; i++) { str = g_strdup (lookup_locale (item, key, locales[i])); } diff -r c91832e94473 -r da33da2e1a1e libpurple/ft.c --- a/libpurple/ft.c Sun Aug 02 04:33:26 2009 +0000 +++ b/libpurple/ft.c Sun Aug 02 05:04:41 2009 +0000 @@ -953,15 +953,15 @@ if (wc != r) { purple_debug_error("filetransfer", "Unable to write whole buffer.\n"); purple_xfer_cancel_local(xfer); + g_free(buffer); return; } } else if(r < 0) { purple_xfer_cancel_remote(xfer); + g_free(buffer); return; } - } - - if (condition & PURPLE_INPUT_WRITE) { + } else if (condition & PURPLE_INPUT_WRITE) { size_t result; size_t s = MIN(purple_xfer_get_bytes_remaining(xfer), xfer->current_buffer_size); diff -r c91832e94473 -r da33da2e1a1e libpurple/protocols/gg/lib/libgadu.c --- a/libpurple/protocols/gg/lib/libgadu.c Sun Aug 02 04:33:26 2009 +0000 +++ b/libpurple/protocols/gg/lib/libgadu.c Sun Aug 02 05:04:41 2009 +0000 @@ -790,6 +790,7 @@ gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv(%d,%p,%d) = %d\n", sess->fd, buf + sizeof(h) + offset, size, ret); if (!ret) { gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv() failed: connection broken\n"); + free(buf); errno = ECONNRESET; return NULL; } diff -r c91832e94473 -r da33da2e1a1e libpurple/protocols/jabber/google.c --- a/libpurple/protocols/jabber/google.c Sun Aug 02 04:33:26 2009 +0000 +++ b/libpurple/protocols/jabber/google.c Sun Aug 02 05:04:41 2009 +0000 @@ -430,7 +430,7 @@ return (session->media != NULL) ? TRUE : FALSE; } -static void +static gboolean google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) { JabberIq *result; @@ -443,7 +443,7 @@ if (session->state != UNINIT) { purple_debug_error("jabber", "Received initiate for active session.\n"); - return; + return FALSE; } desc_element = xmlnode_get_child(sess, "description"); @@ -456,7 +456,7 @@ else { purple_debug_error("jabber", "Received initiate with " "invalid namespace %s.\n", xmlns); - return; + return FALSE; } session->media = purple_media_manager_create_media( @@ -480,7 +480,7 @@ PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); google_session_send_terminate(session); g_free(params); - return; + return FALSE; } g_free(params); @@ -551,6 +551,8 @@ jabber_iq_set_id(result, iq_id); xmlnode_set_attrib(result->node, "to", session->remote_jid); jabber_iq_send(result); + + return TRUE; } static void @@ -776,7 +778,8 @@ session->js = js; session->remote_jid = g_strdup(session->id.initiator); - google_session_parse_iq(js, session, session_node, iq_id); + if (!google_session_handle_initiate(js, session, session_node, iq_id)) + google_session_destroy(session); } #endif /* USE_VV */ diff -r c91832e94473 -r da33da2e1a1e libpurple/protocols/msn/directconn.c --- a/libpurple/protocols/msn/directconn.c Sun Aug 02 04:33:26 2009 +0000 +++ b/libpurple/protocols/msn/directconn.c Sun Aug 02 05:04:41 2009 +0000 @@ -351,6 +351,8 @@ msn_directconn_destroy(directconn); } + + g_free(body); } static void diff -r c91832e94473 -r da33da2e1a1e libpurple/protocols/msnp9/directconn.c --- a/libpurple/protocols/msnp9/directconn.c Sun Aug 02 04:33:26 2009 +0000 +++ b/libpurple/protocols/msnp9/directconn.c Sun Aug 02 05:04:41 2009 +0000 @@ -355,6 +355,8 @@ msn_directconn_destroy(directconn); } + + g_free(body); } static void diff -r c91832e94473 -r da33da2e1a1e libpurple/protocols/yahoo/libymsg.c --- a/libpurple/protocols/yahoo/libymsg.c Sun Aug 02 04:33:26 2009 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Sun Aug 02 05:04:41 2009 +0000 @@ -1830,6 +1830,7 @@ g_free(error_reason); g_free(auth_data->seed); g_free(auth_data); + g_free(token); } else { /* OK to login, correct information provided */ diff -r c91832e94473 -r da33da2e1a1e libpurple/protocols/yahoo/yahoo_filexfer.c --- a/libpurple/protocols/yahoo/yahoo_filexfer.c Sun Aug 02 04:33:26 2009 +0000 +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c Sun Aug 02 05:04:41 2009 +0000 @@ -1593,7 +1593,7 @@ char *service = NULL; char *filename = NULL; char *xfer_peer_idstring = NULL; - char *utf8_filename + char *utf8_filename; unsigned long filesize = 0L; GSList *l; GSList *filename_list = NULL; diff -r c91832e94473 -r da33da2e1a1e pidgin/gtkprefs.c --- a/pidgin/gtkprefs.c Sun Aug 02 04:33:26 2009 +0000 +++ b/pidgin/gtkprefs.c Sun Aug 02 05:04:41 2009 +0000 @@ -698,7 +698,8 @@ g_free(original_name); g_free(info); return; - } else g_free(info); + } else + g_free(info); is_archive = !g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz"); @@ -1032,8 +1033,6 @@ info->original_name = NULL; theme_install_theme(theme_file_name, info); - - g_free(info); } static void diff -r c91832e94473 -r da33da2e1a1e pidgin/plugins/crazychat/glm.c --- a/pidgin/plugins/crazychat/glm.c Sun Aug 02 04:33:26 2009 +0000 +++ b/pidgin/plugins/crazychat/glm.c Sun Aug 02 05:04:41 2009 +0000 @@ -543,6 +543,8 @@ fprintf(file, "Ns %f\n", material->shininess / 128.0 * 1000.0); fprintf(file, "\n"); } + + fclose(file); }