]> code.delx.au - pulseaudio/commitdiff
fix protocol destruction
authorLennart Poettering <lennart@poettering.net>
Wed, 13 Aug 2008 11:51:13 +0000 (13:51 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Aug 2008 11:51:13 +0000 (13:51 +0200)
src/modules/module-protocol-stub.c

index 8136c6fc78286662969b91cdac482754304fe6e7..4fe439f98b6955b2046d956486c06f8b1ae56fc5 100644 (file)
@@ -260,7 +260,7 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
-    u = pa_xnew0(struct userdata, 1);
+    m->userdata = u = pa_xnew0(struct userdata, 1);
     u->module = m;
 
 #if defined(USE_PROTOCOL_SIMPLE)
@@ -368,8 +368,6 @@ int pa__init(pa_module*m) {
 #  endif
 #endif
 
-    m->userdata = u;
-
     if (ma)
         pa_modargs_free(ma);
 
@@ -390,7 +388,8 @@ void pa__done(pa_module*m) {
 
     pa_assert(m);
 
-    u = m->userdata;
+    if (!(u = m->userdata))
+        return;
 
 #if defined(USE_PROTOCOL_SIMPLE)
     if (u->simple_protocol) {