aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Krause <minipli@grsecurity.net>2024-07-30 23:18:27 +0200
committerSam James <sam@gentoo.org>2024-08-09 11:02:43 +0100
commitf87e4803e1b20b6161c05509c5d68152166569c5 (patch)
treecc1bce28ecead47db338b5c6509efd792ca8835f
parenttests: add basic pspax test (diff)
downloadpax-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.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/pspax.c b/pspax.c
index 4cd09b6..b61e7d0 100644
--- a/pspax.c
+++ b/pspax.c
@@ -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);