From a44f885cd476faee2154cbae1a1dc47bdeaea727 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 14 Nov 2023 19:08:15 +0100 Subject: [PATCH] test: Fix short-lived memory leak Warned-by: cppcheck --- test/pwcache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/pwcache.c b/test/pwcache.c index ac1e67b..458903f 100644 --- a/test/pwcache.c +++ b/test/pwcache.c @@ -50,8 +50,10 @@ main(int argc, char **argv) assert(uname != NULL); gr = getgrgid(0); - if (gr == NULL) + if (gr == NULL) { + free(uname); return TEST_SKIP; + } gname = strdup(gr->gr_name); assert(gname != NULL);