# HG changeset patch # User jakub.adam@ktknet.cz # Date 1282625125 0 # Node ID 1feb2baeac2db0f3bc4ab480748268b95cf6fbde # Parent d91e3a6c4a91e4decfc3f84c18444b40abf66ed7 Fix some media code leaks. Fixes #12349. committer: Elliott Sales de Andrade diff -r d91e3a6c4a91 -r 1feb2baeac2d COPYRIGHT --- a/COPYRIGHT Tue Aug 24 04:42:41 2010 +0000 +++ b/COPYRIGHT Tue Aug 24 04:45:25 2010 +0000 @@ -18,6 +18,7 @@ Copyright (C) 1998-2009 by the following: Saleem Abdulrasool +Jakub Adam Dave Ahlswede Manuel Amador Matt Amato diff -r d91e3a6c4a91 -r 1feb2baeac2d libpurple/media.c --- a/libpurple/media.c Tue Aug 24 04:42:41 2010 +0000 +++ b/libpurple/media.c Tue Aug 24 04:45:25 2010 +0000 @@ -515,7 +515,8 @@ if (!media->priv->sessions) { purple_debug_info("media", "Creating hash table for sessions\n"); - media->priv->sessions = g_hash_table_new(g_str_hash, g_str_equal); + media->priv->sessions = g_hash_table_new_full(g_str_hash, g_str_equal, + g_free, NULL); } g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session); } diff -r d91e3a6c4a91 -r 1feb2baeac2d libpurple/media/backend-fs2.c --- a/libpurple/media/backend-fs2.c Tue Aug 24 04:42:41 2010 +0000 +++ b/libpurple/media/backend-fs2.c Tue Aug 24 04:45:25 2010 +0000 @@ -208,11 +208,7 @@ } if (priv->participants) { - GList *participants = - g_hash_table_get_values(priv->participants); - for (; participants; participants = g_list_delete_link( - participants, participants)) - g_object_unref(participants->data); + g_hash_table_destroy(priv->participants); priv->participants = NULL; } @@ -1425,7 +1421,8 @@ if (!priv->sessions) { purple_debug_info("backend-fs2", "Creating hash table for sessions\n"); - priv->sessions = g_hash_table_new(g_str_hash, g_str_equal); + priv->sessions = g_hash_table_new_full(g_str_hash, g_str_equal, + g_free, NULL); } g_hash_table_insert(priv->sessions, g_strdup(session->id), session); @@ -1461,7 +1458,7 @@ purple_debug_info("backend-fs2", "Creating hash table for participants\n"); priv->participants = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, NULL); + g_str_equal, g_free, g_object_unref); } g_hash_table_insert(priv->participants, g_strdup(name), participant); diff -r d91e3a6c4a91 -r 1feb2baeac2d libpurple/media/codec.c --- a/libpurple/media/codec.c Tue Aug 24 04:42:41 2010 +0000 +++ b/libpurple/media/codec.c Tue Aug 24 04:45:25 2010 +0000 @@ -83,9 +83,11 @@ PURPLE_MEDIA_CODEC_GET_PRIVATE(info); g_free(priv->encoding_name); for (; priv->optional_params; priv->optional_params = - g_list_delete_link(priv->optional_params, - priv->optional_params)) { - g_free(priv->optional_params->data); + g_list_delete_link(priv->optional_params, priv->optional_params)) { + PurpleKeyValuePair *param = priv->optional_params->data; + g_free(param->key); + g_free(param->value); + g_free(param); } } @@ -302,10 +304,10 @@ g_free(param->key); g_free(param->value); - g_free(param); priv->optional_params = g_list_remove(priv->optional_params, param); + g_free(param); } PurpleKeyValuePair *