/pidgin/main: 457ce85caedc: mediamanager: fix invalid memory read

Jakub Adam <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: 457ce85caedc607f61a8f361df35928d0c9b6fc5
Author:	 Jakub Adam <[email protected]>
Date:	 2016-06-10 16:47 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/457ce85caedc

Description:

mediamanager: fix invalid memory read

Loop was accessing 'next' pointer in already deallocated GList item.
Reported by Valgrind.

diffstat:

 libpurple/mediamanager.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (23 lines):

diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -458,14 +458,18 @@ purple_media_manager_remove_media(Purple
 
 #ifdef HAVE_MEDIA_APPLICATION
 		g_mutex_lock (&manager->priv->appdata_mutex);
-		for (list = manager->priv->appdata_info; list; list = list->next) {
+		list = manager->priv->appdata_info;
+		while (list) {
 			PurpleMediaAppDataInfo *info = list->data;
+			GList *next = list->next;
 
 			if (info->media == media) {
 				manager->priv->appdata_info = g_list_delete_link (
 					manager->priv->appdata_info, list);
 				free_appdata_info_locked (info);
 			}
+
+			list = next;
 		}
 		g_mutex_unlock (&manager->priv->appdata_mutex);
 #endif

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.