diff options
author | Mathias Krause <minipli@grsecurity.net> | 2024-07-30 23:18:27 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-08-09 11:02:43 +0100 |
commit | f87e4803e1b20b6161c05509c5d68152166569c5 (patch) | |
tree | cc1bce28ecead47db338b5c6509efd792ca8835f | |
parent | tests: add basic pspax test (diff) | |
download | pax-utils-f87e4803e1b20b6161c05509c5d68152166569c5.tar.gz pax-utils-f87e4803e1b20b6161c05509c5d68152166569c5.tar.bz2 pax-utils-f87e4803e1b20b6161c05509c5d68152166569c5.zip |
pspax: fix libcap memory leaks
Every cap_t needs to be free'd by calling cap_free() which does a NULL
pointer test itself so callers don't need to.
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | pspax.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -345,8 +345,6 @@ static void pspax(const char *find_name) int pfd; WRAP_SYSCAP(ssize_t length; cap_t cap_d;) - WRAP_SYSCAP(cap_d = cap_init()); - dir = opendir(PROC_DIR); if (dir == NULL || chdir(PROC_DIR)) errp(PROC_DIR); @@ -438,7 +436,8 @@ static void pspax(const char *find_name) print_executable_mappings(pfd); } - WRAP_SYSCAP(if (caps) cap_free(caps)); + WRAP_SYSCAP(cap_free(cap_d)); + WRAP_SYSCAP(cap_free(caps)); next_pid: close(pfd); |