libepc r228 - in trunk: . libepc



Author: hasselmm
Date: Sun Jun 22 20:13:16 2008
New Revision: 228
URL: http://svn.gnome.org/viewvc/libepc?rev=228&view=rev

Log:
Try to prevent crash after avahi_service_browser_free (#539630).

* libepc/service-monitor.c (epc_service_monitor_constructed()):
  Really never add NULL pointer to internal browser list when
  epc_shell_create_service_browser() returns NULL, but forgets
  to raise an exception (set the error variable).

* libepc/shell.c (epc_shell_create_service_browser()):
  Set error variable when avahi_service_browser_new() returns NULL.


Modified:
   trunk/ChangeLog
   trunk/libepc/service-monitor.c
   trunk/libepc/shell.c

Modified: trunk/libepc/service-monitor.c
==============================================================================
--- trunk/libepc/service-monitor.c	(original)
+++ trunk/libepc/service-monitor.c	Sun Jun 22 20:13:16 2008
@@ -290,6 +290,9 @@
           continue;
       }
 
+      if (G_UNLIKELY (!browser))
+        continue;
+
       if (EPC_DEBUG_LEVEL (1))
         g_debug ("%s: watching %s", G_STRLOC, *iter);
 

Modified: trunk/libepc/shell.c
==============================================================================
--- trunk/libepc/shell.c	(original)
+++ trunk/libepc/shell.c	Sun Jun 22 20:13:16 2008
@@ -368,6 +368,10 @@
     browser = avahi_service_browser_new (client, interface, protocol, type,
                                          domain, flags, callback, user_data);
 
+  if (G_UNLIKELY (!browser))
+    g_set_error (error, EPC_AVAHI_ERROR, AVAHI_ERR_FAILURE,
+                 _("Cannot create Avahi service browser."));
+
   return browser;
 }
 



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