diff --git a/src/cmd/cmd.c b/src/cmd/cmd.c index 41ae78cdd3..fd4fc78803 100644 --- a/src/cmd/cmd.c +++ b/src/cmd/cmd.c @@ -620,7 +620,9 @@ cmd_AddParmAlias(struct cmd_syndesc *as, int pos, char *alias) return CMD_EXCESSPARMS; item = calloc(1, sizeof(struct cmd_item)); + assert(item != NULL); item->data = strdup(alias); + assert(item->data != NULL); item->next = as->parms[pos].aliases; as->parms[pos].aliases = item; @@ -1445,8 +1447,10 @@ cmd_OptionAsList(struct cmd_syndesc *syn, int pos, struct cmd_item **value) start = str; while ((end = strchr(start, ' '))) { item = calloc(1, sizeof(struct cmd_item)); + assert(item != NULL); len = end - start + 1; item->data = malloc(len); + assert(item->data != NULL); strlcpy(item->data, start, len); *last = item; last = &item->next; @@ -1456,8 +1460,10 @@ cmd_OptionAsList(struct cmd_syndesc *syn, int pos, struct cmd_item **value) /* Catch the final element */ if (*start != '\0') { item = calloc(1, sizeof(struct cmd_item)); + assert(item != NULL); len = strlen(start) + 1; item->data = malloc(len); + assert(item->data != NULL); strlcpy(item->data, start, len); *last = item; }