From: F. Aragon Date: Thu, 20 Sep 2018 14:23:52 +0000 (+0200) Subject: tools: null check (Coverity 1399484) X-Git-Tag: frr-7.1-dev~349^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F3058%2Fhead;p=mirror%2Ffrr.git tools: null check (Coverity 1399484) Fixed using XCALLOC(MTYPE_TMP, ...) instead of calloc(...) because of the error handling (XCALLOC checks + log + abort through memory_oom()) Signed-off-by: F. Aragon --- diff --git a/tools/permutations.c b/tools/permutations.c index c5109dc3e8..f51d4a4ec9 100644 --- a/tools/permutations.c +++ b/tools/permutations.c @@ -39,7 +39,8 @@ int main(int argc, char *argv[]) fprintf(stdout, USAGE "\n"); exit(EXIT_SUCCESS); } - struct cmd_element *cmd = calloc(1, sizeof(struct cmd_element)); + struct cmd_element *cmd = XCALLOC(MTYPE_TMP, + sizeof(struct cmd_element)); cmd->string = strdup(argv[1]); struct graph *graph = graph_new();