summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@intel.com>2011-08-15 09:51:37 +0800
committerColin Guthrie <colin@mageia.org>2011-08-15 09:41:56 +0100
commitecbb4b4ef4ac91f4d79e537ea07492634f50037d (patch)
tree05e02c4742f645f1e939a6b1f9596a616c64bece
parenta1ce2426d8cd63f0bd1772b3491d765e9af2b1e7 (diff)
downloadpulseaudio-panda-ecbb4b4ef4ac91f4d79e537ea07492634f50037d.tar.gz
pulseaudio-panda-ecbb4b4ef4ac91f4d79e537ea07492634f50037d.tar.bz2
pulseaudio-panda-ecbb4b4ef4ac91f4d79e537ea07492634f50037d.zip
memblock: fix memory leak when pa_shm_create_rw fails
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
-rw-r--r--src/pulsecore/memblock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index e34a7395..19be1517 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -711,9 +711,6 @@ pa_mempool* pa_mempool_new(pa_bool_t shared, size_t size) {
p = pa_xnew(pa_mempool, 1);
- p->mutex = pa_mutex_new(TRUE, TRUE);
- p->semaphore = pa_semaphore_new(0);
-
p->block_size = PA_PAGE_ALIGN(PA_MEMPOOL_SLOT_SIZE);
if (p->block_size < PA_PAGE_SIZE)
p->block_size = PA_PAGE_SIZE;
@@ -745,6 +742,9 @@ pa_mempool* pa_mempool_new(pa_bool_t shared, size_t size) {
PA_LLIST_HEAD_INIT(pa_memimport, p->imports);
PA_LLIST_HEAD_INIT(pa_memexport, p->exports);
+ p->mutex = pa_mutex_new(TRUE, TRUE);
+ p->semaphore = pa_semaphore_new(0);
+
p->free_slots = pa_flist_new(p->n_blocks);
return p;