[pulseaudio-commits] r1376 - /trunk/src/pulse/context.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed Sep 6 15:19:56 PDT 2006


Author: lennart
Date: Thu Sep  7 00:19:54 2006
New Revision: 1376

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1376&root=pulseaudio&view=rev
Log:
don't hit an assert in the client if posix shm is not available

Modified:
    trunk/src/pulse/context.c

Modified: trunk/src/pulse/context.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulse/context.c?rev=1376&root=pulseaudio&r1=1375&r2=1376&view=diff
==============================================================================
--- trunk/src/pulse/context.c (original)
+++ trunk/src/pulse/context.c Thu Sep  7 00:19:54 2006
@@ -98,6 +98,8 @@
     }
 }
 
+static void context_free(pa_context *c);
+
 pa_context *pa_context_new(pa_mainloop_api *mainloop, const char *name) {
     pa_context *c;
     
@@ -148,7 +150,16 @@
 #endif
     pa_client_conf_env(c->conf);
 
-    c->mempool = pa_mempool_new(!c->conf->disable_shm);
+    if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm))) {
+
+        if (!c->conf->disable_shm)
+            c->mempool = pa_mempool_new(0);
+
+        if (!c->mempool) {
+            context_free(c);
+            return NULL;
+        }
+    }
 
     return c;
 }
@@ -178,7 +189,8 @@
     if (c->playback_streams)
         pa_dynarray_free(c->playback_streams, NULL, NULL);
 
-    pa_mempool_free(c->mempool);
+    if (c->mempool)
+        pa_mempool_free(c->mempool);
 
     if (c->conf)
         pa_client_conf_free(c->conf);




More information about the pulseaudio-commits mailing list