Skip to content

Commit 4c23a08

Browse files
committed
Don't print usage on memory error
This is not a usage error, and hiding the real error is the worst thing we can do. Instead use perror() and exit. Signed-off-by: Nir Soffer <[email protected]>
1 parent f486d47 commit 4c23a08

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cli.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ static void print_version() { puts(VERSION); }
7373
struct cli_options *cli_options_parse(int argc, char *argv[]) {
7474
struct cli_options *res = malloc(sizeof(*res));
7575
if (res == NULL) {
76-
goto error;
76+
perror("calloc");
77+
exit(EXIT_FAILURE);
7778
}
7879
memset(res, 0, sizeof(*res));
7980

0 commit comments

Comments
 (0)