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 <sam@gentoo.org>
This commit is contained in:
Sam James 2022-03-29 09:05:59 +01:00 committed by William Hubbs
parent e7f45ce31f
commit adc1e33f7e

View File

@ -140,6 +140,8 @@ static int get_dirfd(char *path, bool symlinks)
item = strtok(NULL, "/");
components--;
}
free(str);
}
free(path_dupe);
free(linkpath);