From 04c7cdd33abd389cbd017accd290ab1ef0393a19 Mon Sep 17 00:00:00 2001 From: Jerzy Jamroz Date: Wed, 5 Feb 2025 10:14:22 +0100 Subject: [PATCH] fix: Removal of unnecessary item->cmd NULL check. --- modules/libcom/src/iocsh/atInit.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/libcom/src/iocsh/atInit.c b/modules/libcom/src/iocsh/atInit.c index 5b732d5e8..023151026 100644 --- a/modules/libcom/src/iocsh/atInit.c +++ b/modules/libcom/src/iocsh/atInit.c @@ -58,13 +58,7 @@ static struct cmditem* newItem(char* cmd) ERL_ERROR " atInit: " "failed to allocate memory for cmditem"); item->cmd = (char*)(item + 1); - memcpy(item->cmd, cmd, strlen(cmd) + 1); - - if (item->cmd == NULL) { - free(item); - errno = ENOMEM; - return NULL; - } + strlcpy(item->cmd, cmd, strlen(cmd) + 1); ellAdd(&s_cmdlist, &item->node);