commandhelper: Use automatic memory management in printCwd

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-02-01 12:28:02 +01:00 committed by Peter Krempa
parent 0793d15685
commit 99502fa790

View 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;
}