[pulseaudio-discuss] [PATCH 1/2] memblock: fix memory leak when pa_shm_create_rw fails

Lu Guanqun guanqun.lu at intel.com
Sun Aug 14 22:24:46 PDT 2011


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

diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index e34a739..332fcb7 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -728,6 +728,8 @@ pa_mempool* pa_mempool_new(pa_bool_t shared, size_t size) {
     }
 
     if (pa_shm_create_rw(&p->memory, p->n_blocks * p->block_size, shared, 0700) < 0) {
+        pa_semaphore_free(p->semaphore);
+        pa_mutex_free(p->mutex);
         pa_xfree(p);
         return NULL;
     }



More information about the pulseaudio-discuss mailing list