dbus: Don't crash if the module does not load
authorDavid Henningsson <david.henningsson@canonical.com>
Thu, 22 Sep 2011 11:57:56 +0000 (13:57 +0200)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Thu, 22 Sep 2011 17:45:18 +0000 (23:15 +0530)
If module-dbus-protocol fails to start, pa__done is still called,
which falsified the assumption that u->connections was always set.

BugLink: http://bugs.launchpad.net/bugs/855729
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
src/modules/dbus/module-dbus-protocol.c

index ae9df20..c24e1e0 100644 (file)
@@ -594,10 +594,12 @@ void pa__done(pa_module *m) {
     if (u->core_iface)
         pa_dbusiface_core_free(u->core_iface);
 
-    while ((c = pa_idxset_steal_first(u->connections, NULL)))
-        connection_free(c);
+    if (u->connections) {
+        while ((c = pa_idxset_steal_first(u->connections, NULL)))
+            connection_free(c);
 
-    pa_idxset_free(u->connections, NULL, NULL);
+        pa_idxset_free(u->connections, NULL, NULL);
+    }
 
     /* This must not be called before the connections are freed, because if
      * there are any connections left, they will emit the