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
This commit is contained in:
Lennart Poettering 2006-09-06 22:19:54 +00:00
parent ead67cda48
commit 40ecf869d0

View file

@ -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 *pa_context_new(pa_mainloop_api *mainloop, const char *name) {
pa_context *c; pa_context *c;
@ -148,7 +150,16 @@ pa_context *pa_context_new(pa_mainloop_api *mainloop, const char *name) {
#endif #endif
pa_client_conf_env(c->conf); 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; return c;
} }
@ -178,7 +189,8 @@ static void context_free(pa_context *c) {
if (c->playback_streams) if (c->playback_streams)
pa_dynarray_free(c->playback_streams, NULL, NULL); pa_dynarray_free(c->playback_streams, NULL, NULL);
pa_mempool_free(c->mempool); if (c->mempool)
pa_mempool_free(c->mempool);
if (c->conf) if (c->conf)
pa_client_conf_free(c->conf); pa_client_conf_free(c->conf);