]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Fix memory leak in para_play().
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 6 Oct 2022 15:12:13 +0000 (17:12 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 12 Feb 2023 22:45:21 +0000 (23:45 +0100)
We leak one filter parse result per audio file played. Valgrind reports:

==24559== 24 (12 direct, 12 indirect) bytes in 1 blocks are definitely lost in loss record 34 of 104
==24559==    at 0x4044B0B: calloc (vg_replace_malloc.c:1328)
==24559==    by 0x453A997: lls_parse (lopsub.c:768)
==24559==    by 0x8057612: filter_setup (filter_common.c:98)
==24559==    by 0x80500A4: load_file (play.c:377)
==24559==    by 0x80500A4: load_next_file (play.c:454)
==24559==    by 0x80500A4: play_post_monitor (play.c:1154)
==24559==    by 0x8051110: call_post_monitor (sched.c:80)
==24559==    by 0x8051110: sched_post_monitor (sched.c:106)
==24559==    by 0x8051110: schedule (sched.c:148)
==24559==    by 0x804EB80: main (play.c:1217)

play.c

diff --git a/play.c b/play.c
index 055293a905807a7641e382de7e7ff6cd9f8f15a7..8ee91504ffa6181030ababe8335d29b5dd7987fd 100644 (file)
--- a/play.c
+++ b/play.c
@@ -7,6 +7,7 @@
 #include <lopsub.h>
 
 #include "recv_cmd.lsg.h"
+#include "filter_cmd.lsg.h"
 #include "play_cmd.lsg.h"
 #include "write_cmd.lsg.h"
 #include "play.lsg.h"
@@ -256,6 +257,7 @@ static int eof_cleanup(void)
        if (decoder->close)
                decoder->close(&pt->fn);
        btr_remove_node(&pt->fn.btrn);
+       lls_free_parse_result(pt->fn.lpr, FILTER_CMD(pt->fn.filter_num));
        free(pt->fn.conf);
        memset(&pt->fn, 0, sizeof(struct filter_node));