]> git.puffer.fish Git - mirror/frr.git/commitdiff
tools: null check (Coverity 1399484) 3058/head
authorF. Aragon <paco@voltanet.io>
Thu, 20 Sep 2018 14:23:52 +0000 (16:23 +0200)
committerF. Aragon <paco@voltanet.io>
Thu, 20 Sep 2018 14:23:52 +0000 (16:23 +0200)
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 <paco@voltanet.io>
tools/permutations.c

index c5109dc3e8823b626d82f3d676bfc38d3a0ae14d..f51d4a4ec9a845a84e9d9117bcbc41ef2b5ae4d0 100644 (file)
@@ -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();