From: Vincent Bernat Date: Sun, 21 Mar 2021 10:21:24 +0000 (+0100) Subject: client: do not allow memory allocations to fail X-Git-Tag: 1.0.9~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7eae6f879d89d2a223774a253d80b6f0b5c5d01;p=thirdparty%2Flldpd.git client: do not allow memory allocations to fail This leads to some memory leak (quite improbable), but we don't want to continue running with an incomplete set of commands. --- diff --git a/src/client/commands.c b/src/client/commands.c index 291a63b6..7e35ecb1 100644 --- a/src/client/commands.c +++ b/src/client/commands.c @@ -167,10 +167,8 @@ commands_new(struct cmd_node *root, void *arg) { struct cmd_node *new = calloc(1, sizeof(struct cmd_node)); - if (new == NULL) { - log_warn("lldpctl", "unable to allocate memory for new command node"); - return NULL; - } + if (new == NULL) + fatalx("lldpctl", "out of memory"); new->token = token; new->doc = doc; new->validate = validate;