pidgin: 339664dc: Fix some media code leaks.

qulogic at pidgin.im qulogic at pidgin.im
Tue Aug 24 00:56:14 EDT 2010


----------------------------------------------------------------------
Revision: 339664dc0d1f04ffbc4a4bedd839e10b3628e75e
Parent:   eac481835c82f35a7bef6d6fa2416c38358c1b3a
Author:   jakub.adam at ktknet.cz
Date:     08/24/10 00:45:25
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/339664dc0d1f04ffbc4a4bedd839e10b3628e75e

Changelog: 

Fix some media code leaks.

Fixes #12349.

Changes against parent eac481835c82f35a7bef6d6fa2416c38358c1b3a

  patched  COPYRIGHT
  patched  libpurple/media/backend-fs2.c
  patched  libpurple/media/codec.c
  patched  libpurple/media.c

-------------- next part --------------
============================================================
--- COPYRIGHT	2f19539b45dd3ca6449a09744f878c9b6f72063a
+++ COPYRIGHT	5de54f65c8d9839ed46ea4ab298ac4bd011fa92e
@@ -18,6 +18,7 @@ Saleem Abdulrasool
 Copyright (C) 1998-2009 by the following:
 
 Saleem Abdulrasool
+Jakub Adam
 Dave Ahlswede
 Manuel Amador
 Matt Amato
============================================================
--- libpurple/media.c	a0bd565beb0cd7154d63820f7f16804e44385bea
+++ libpurple/media.c	d6492d3cbe6800246798996e987df68036e3ef0d
@@ -515,7 +515,8 @@ purple_media_add_session(PurpleMedia *me
 
 	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);
 }
============================================================
--- libpurple/media/codec.c	3cb37cf90c251d4dd95c079ade2224fa739ef55f
+++ libpurple/media/codec.c	296d1785893ce23e6f0a646836e69f580d05a225
@@ -83,9 +83,11 @@ purple_media_codec_finalize(GObject *inf
 			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 @@ purple_media_codec_remove_optional_param
 
 	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 *
============================================================
--- libpurple/media/backend-fs2.c	790581c1f3233eb3b5419a853ce2ae5f1486216f
+++ libpurple/media/backend-fs2.c	30963d565a448399016fab891f7aee15beaa7449
@@ -208,11 +208,7 @@ purple_media_backend_fs2_dispose(GObject
 	}
 
 	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 @@ create_session(PurpleMediaBackendFs2 *se
 	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 @@ create_participant(PurpleMediaBackendFs2
 		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);


More information about the Commits mailing list