[gnome-user-share] Fix work-around for possible double-free



commit be5a1997a7c360e4e30118f62ee75380e3bb8c14
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jun 11 21:19:00 2009 +0100

    Fix work-around for possible double-free
    
    2009-06-11  Bastien Nocera  <hadess hadess net>
    
    	* src/obexpush.c (show_notification): Fix work-around
    	for possible double-free, as seen in:
    	https://bugzilla.redhat.com/show_bug.cgi?id=451001

 ChangeLog      |    6 ++++++
 src/obexpush.c |    9 ++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f88febb..57e098e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-11  Bastien Nocera  <hadess hadess net>
+
+	* src/obexpush.c (show_notification): Fix work-around
+	for possible double-free, as seen in:
+	https://bugzilla.redhat.com/show_bug.cgi?id=451001
+
 2009-03-25  Claude Paroz  <claude 2xlibre net>
 
 	* help/fr/figures/*.png:
diff --git a/src/obexpush.c b/src/obexpush.c
index 10a1da1..8a16aed 100644
--- a/src/obexpush.c
+++ b/src/obexpush.c
@@ -147,17 +147,16 @@ show_notification (const char *filename)
 	mime_type = g_content_type_guess (filename, NULL, 0, NULL);
 	app = g_app_info_get_default_for_type (mime_type, FALSE);
 	if (app != NULL) {
-		/* FIXME duplicate the uri, otherwise libnotify crashes */
-		char *uri;
 		g_object_unref (app);
-		uri = g_strdup (file_uri);
 		notify_notification_add_action (notification, "display", _("Open File"),
 						(NotifyActionCallback) notification_launch_action_on_file_cb,
-						(gpointer) uri, (GFreeFunc) g_free);
+						g_strdup (file_uri), (GFreeFunc) g_free);
 	}
 	notify_notification_add_action (notification, "reveal", _("Reveal File"),
 					(NotifyActionCallback) notification_launch_action_on_file_cb,
-					(gpointer) file_uri, (GFreeFunc) g_free);
+					g_strdup (file_uri), (GFreeFunc) g_free);
+
+	g_free (file_uri);
 	
 	g_signal_connect (G_OBJECT (notification), "closed", G_CALLBACK (on_close_notification), notification);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]