Avoid accessing members of a destroyed GError
authorAlberto Mardegan <mardy@users.sourceforge.net>
Sun, 17 Apr 2011 08:18:07 +0000 (11:18 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Sun, 17 Apr 2011 16:07:54 +0000 (19:07 +0300)
After g_propagate_error() has been called, the original error has either
been destroyed or moved; this code was accessing the contents of the
GError after it had been free'd.

libgssdp/gssdp-socket-source.c

index 7467de0..79b13c2 100644 (file)
@@ -308,11 +308,11 @@ error:
         if (group != NULL)
                 g_object_unref (group);
         if (inner_error != NULL) {
-                if (error == NULL) {
-                        g_warning ("Failed to create socket source: %s",
-                                   inner_error->message);
-                        g_error_free (inner_error);
-                }
+                /* Be aware that inner_error has already been free'd by
+                 * g_propagate_error(), so we cannot access its contents
+                 * anymore. */
+                if (error == NULL)
+                        g_warning ("Failed to create socket source");
 
                 return FALSE;
         }