From adc1e33f7e673d90b2ce169a3da337c6c22b6518 Mon Sep 17 00:00:00 2001 From: Sam James Date: Tue, 29 Mar 2022 09:05:59 +0100 Subject: checkpath: fix memory leak ``` Direct leak of 4 byte(s) in 1 object(s) allocated from: #0 0x7f49539534a7 in __interceptor_strdup /usr/src/debug/sys-devel/gcc-11.2.1_p20220312/gcc-11-20220312/libsanitizer/asan/asan_interceptors.cpp:454 #1 0x55d76fa66867 in xstrdup ../src/includes/helpers.h:91 #2 0x55d76fa66867 in get_dirfd ../src/rc/checkpath.c:111 #3 0x55d76fa66867 in do_check ../src/rc/checkpath.c:206 #4 0x55d76fa66867 in main ../src/rc/checkpath.c:442 #5 0x7f49536f06cf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 ``` Signed-off-by: Sam James --- src/checkpath/checkpath.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/checkpath/checkpath.c b/src/checkpath/checkpath.c index de5d1b4a..42864276 100644 --- a/src/checkpath/checkpath.c +++ b/src/checkpath/checkpath.c @@ -140,6 +140,8 @@ static int get_dirfd(char *path, bool symlinks) item = strtok(NULL, "/"); components--; } + + free(str); } free(path_dupe); free(linkpath); -- cgit v1.2.3