From f7eae6f879d89d2a223774a253d80b6f0b5c5d01 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sun, 21 Mar 2021 11:21:24 +0100 Subject: [PATCH] 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. --- src/client/commands.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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; -- 2.39.5