Skip to content

Commit 31bedc1

Browse files
Luo Yifanacmel
authored andcommitted
libsubcmd: Move va_end() before exit
This patch makes a minor adjustment by moving the va_end call before exit. Since the exit() function terminates the program, any code after exit(128) (i.e., va_end(params)) is unreachable and thus not executed. Placing va_end before exit ensures that the va_list is properly cleaned up. Signed-off-by: Luo Yifan <[email protected]> Cc: Josh Poimboeuf <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent b81bb70 commit 31bedc1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/subcmd/subcmd-util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ static __noreturn inline void die(const char *err, ...)
2020

2121
va_start(params, err);
2222
report(" Fatal: ", err, params);
23-
exit(128);
2423
va_end(params);
24+
exit(128);
2525
}
2626

2727
#define zfree(ptr) ({ free(*ptr); *ptr = NULL; })

0 commit comments

Comments
 (0)