summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-09-06 22:19:54 +0000
committerLennart Poettering <lennart@poettering.net>2006-09-06 22:19:54 +0000
commit40ecf869d0f77a3af2ce59bc060c4bccd2baec25 (patch)
treec37d2d6b89b080564400cebb75df605989e28e9f /src
parentead67cda48f58ad8d1f53ce2c32e3b500dfc5a19 (diff)
don't hit an assert in the client if posix shm is not available
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1376 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src')
-rw-r--r--src/pulse/context.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/pulse/context.c b/src/pulse/context.c
index b700657b..a458c6b1 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -98,6 +98,8 @@ static void unlock_autospawn_lock_file(pa_context *c) {
}
}
+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 @@ pa_context *pa_context_new(pa_mainloop_api *mainloop, const char *name) {
#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 @@ static void context_free(pa_context *c) {
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);