From 3b23c6c379c2b3a2f9fdbf3aec7cb5e0158c498d Mon Sep 17 00:00:00 2001 From: "F. Aragon" Date: Thu, 20 Sep 2018 16:23:52 +0200 Subject: [PATCH] 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 --- tools/permutations.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); -- 2.39.5