]> xenbits.xensource.com Git - libvirt.git/commitdiff
commandhelper: Use automatic memory management in printCwd
authorTim Wiederhake <twiederh@redhat.com>
Mon, 1 Feb 2021 11:28:02 +0000 (12:28 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 2 Feb 2021 14:00:54 +0000 (15:00 +0100)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tests/commandhelper.c

index 854f3c09bfb2db96bdb67e740cccbe8c2b9415c1..5f0c1f5a51d7fc9e9617db96a8ef110d11695dcf 100644 (file)
@@ -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;
 }