]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm_file: fixed memory leak.
authorAndrey Mazo <mazo@telum.ru>
Sat, 16 Nov 2013 21:11:55 +0000 (01:11 +0400)
committerTakashi Iwai <tiwai@suse.de>
Sun, 17 Nov 2013 09:15:34 +0000 (10:15 +0100)
Valgrind report for this leak was:

Command: aplay -Dfile:'/tmp/qqq',raw qqq.wav

14 bytes in 1 blocks are definitely lost in loss record 1 of 2
   at 0x402BF5C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
   by 0x40D7557: snd_pcm_file_hw_params (in /usr/lib/libasound.so.2.0.0)
   by 0x40BA093: _snd_pcm_hw_params_internal (in /usr/lib/libasound.so.2.0.0)
   by 0x40AB831: snd_pcm_hw_params (in /usr/lib/libasound.so.2.0.0)
   by 0x804C523: ??? (in /usr/bin/aplay)
   by 0x804E5B7: ??? (in /usr/bin/aplay)
   by 0x804FC8C: ??? (in /usr/bin/aplay)
   by 0x80520FB: ??? (in /usr/bin/aplay)
   by 0x4184942: (below main) (libc-start.c:226)

Signed-off-by: Andrey Mazo <mazo@telum.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_file.c

index 3d14090fd2ea3ba1dd6b8c17ba55cd66e16688d8..c3e67b2b26385046eec399b3373dfe733f06ba99 100644 (file)
@@ -592,8 +592,10 @@ static int snd_pcm_file_hw_free(snd_pcm_t *pcm)
        snd_pcm_file_t *file = pcm->private_data;
        free(file->wbuf);
        free(file->wbuf_areas);
+       free(file->final_fname);
        file->wbuf = NULL;
        file->wbuf_areas = NULL;
+       file->final_fname = NULL;
        return snd_pcm_hw_free(file->gen.slave);
 }