From a805a5254b06f30574f8d322fa451763335c1ee1 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 13 Mar 2019 22:37:32 +0800 Subject: [PATCH 18/19] mangenerator: check strdup was successfull Check for strdup != NULL and drop unneeded zeroing when buffer is overwritten. --- tools/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/command.c b/tools/command.c index f2a2722..9516fde 100644 --- a/tools/command.c +++ b/tools/command.c @@ -1465,7 +1465,7 @@ int define_commands(struct cmd_context *cmdtool, const char *run_name) if (_is_desc_line(line_argv[0]) && !skip && cmd) { char *desc = dm_pool_strdup(cmdtool->libmem, line_orig); - if (cmd->desc) { + if (cmd->desc && desc) { int newlen = strlen(cmd->desc) + strlen(desc) + 2; char *newdesc = dm_pool_alloc(cmdtool->libmem, newlen); if (newdesc) { -- 2.19.1