Skip to content

Commit 97d59a8

Browse files
committed
Replace malloc(), memset() with calloc()
Same effect, simpler code. Signed-off-by: Nir Soffer <[email protected]>
1 parent 4c23a08 commit 97d59a8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cli.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,11 @@ static void print_version() { puts(VERSION); }
7171
#define CLI_OPTIONS_ID_VMNET_INTERFACE_ID -48
7272
#define CLI_OPTIONS_ID_VMNET_NAT66_PREFIX -50
7373
struct cli_options *cli_options_parse(int argc, char *argv[]) {
74-
struct cli_options *res = malloc(sizeof(*res));
74+
struct cli_options *res = calloc(1, sizeof(*res));
7575
if (res == NULL) {
7676
perror("calloc");
7777
exit(EXIT_FAILURE);
7878
}
79-
memset(res, 0, sizeof(*res));
8079

8180
const struct option longopts[] = {
8281
{"socket-group", required_argument, NULL, CLI_OPTIONS_ID_SOCKET_GROUP},

0 commit comments

Comments
 (0)