]> git.tue.mpg.de Git - paraslash.git/commitdiff
mp4: Fix memory leak in mp4_meta_update().
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 13 Aug 2021 20:00:32 +0000 (22:00 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
This function calls modify_moov() which allocates and returns a
possibly large buffer, but this buffer is never freed.

Found by valgrind.

mp4.c

diff --git a/mp4.c b/mp4.c
index f576529c0a954967e327834ae2b4e0bd204f24e2..d2a54eb2b0c4370dfe0010a669681f2398f8e6dd 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -1742,6 +1742,7 @@ int32_t mp4_meta_update(const struct mp4_callback *cb,
                write_data(f, "moov", 4);
                write_data(f, new_moov_data, new_moov_size);
        }
+       free(new_moov_data);
        cb->truncate(cb->user_data);
        mp4_close(f);
        return 1;