[PATCH] memblock: fix memory leak when pa_shm_create_rw fails

Lu Guanqun guanqun.lu at intel.com
Sun Aug 14 18:51:37 PDT 2011


Signed-off-by: Lu Guanqun <guanqun.lu at intel.com>
---
 src/pulsecore/memblock.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index e34a739..19be151 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;
-- 
1.7.6


--IS0zKkzwUGydFO0o--


More information about the pulseaudio-discuss mailing list