From 083f73a01fa41c6168dcd926c37fa7cc06e9b5e1 Mon Sep 17 00:00:00 2001 From: Eero Nurkkala Date: Wed, 22 Jul 2020 10:51:54 +0300 Subject: [PATCH] gst-inspect: fix memory leak With meson configure option: -Db_sanitize=address, the following issue is seen while running the test "tools_gstinspect": Running suite(s): gst-inspect ================================================================= ==20880==ERROR: LeakSanitizer: detected memory leaks Direct leak of 51 byte(s) in 9 object(s) allocated from: #0 0x7ffb4dbb0b40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40) #1 0x7ffb4cdf1ab8 in g_malloc (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x51ab8) SUMMARY: AddressSanitizer: 51 byte(s) leaked in 9 allocation(s). 0%: Checks: 1, Failures: 0, Errors: 1 GOptionEntry man page states that: "Please note that parsed arguments need to be freed separately (see GOptionEntry)." Thus, free the 'min_version' string that has been allocated but never freed. Signed-off-by: Eero Nurkkala Part-of: --- tools/gst-inspect.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 8da0429465..6f61500f40 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -2049,8 +2049,10 @@ main (int argc, char *argv[]) &minver_micro) < 2) { g_printerr ("Can't parse version '%s' passed to --atleast-version\n", min_version); + g_free (min_version); return -1; } + g_free (min_version); check_exists = TRUE; }