From bbf60ab1375d5ad76bea4554b96dcc72f6c5f06a Mon Sep 17 00:00:00 2001 From: gineera Date: Thu, 22 Aug 2013 22:01:17 +0000 Subject: [PATCH] Alsa: Fix memory leak as nonMmapBuffers were not freed (since change to realloc). Clean out corresponding dead code chunk. --- src/hostapi/alsa/pa_linux_alsa.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/hostapi/alsa/pa_linux_alsa.c b/src/hostapi/alsa/pa_linux_alsa.c index 6885fc1..32c1f76 100644 --- a/src/hostapi/alsa/pa_linux_alsa.c +++ b/src/hostapi/alsa/pa_linux_alsa.c @@ -1898,8 +1898,8 @@ error: static void PaAlsaStreamComponent_Terminate( PaAlsaStreamComponent *self ) { alsa_snd_pcm_close( self->pcm ); - if( self->userBuffers ) - PaUtil_FreeMemory( self->userBuffers ); + PaUtil_FreeMemory( self->userBuffers ); /* (Ptr can be NULL; PaUtil_FreeMemory includes a NULL check) */ + PaUtil_FreeMemory( self->nonMmapBuffer ); } /* @@ -3450,13 +3450,6 @@ static PaError PaAlsaStreamComponent_EndProcessing( PaAlsaStreamComponent *self, if( self->canMmap ) res = alsa_snd_pcm_mmap_commit( self->pcm, self->offset, numFrames ); - else - { - /* using realloc for optimisation - free( self->nonMmapBuffer ); - self->nonMmapBuffer = NULL; - */ - } if( res == -EPIPE || res == -ESTRPIPE ) { -- 2.43.0