From 99502fa79056e55d086dd2f4d3aa8d41311cff9b Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Mon, 1 Feb 2021 12:28:02 +0100 Subject: [PATCH] commandhelper: Use automatic memory management in printCwd Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/commandhelper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 854f3c09bf..5f0c1f5a51 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -194,7 +194,7 @@ static void printDaemonization(FILE *log, struct Arguments *args) static int printCwd(FILE *log) { - char *cwd = NULL; + cleanup(char *, cleanupGeneric) cwd = NULL; char *display; if (!(cwd = getcwd(NULL, 0))) @@ -213,7 +213,6 @@ static int printCwd(FILE *log) # endif fprintf(log, "CWD:%s\n", display); - free(cwd); return 0; }