X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;ds=inline;f=src%2Fcommon%2Fspawn-viewer.cpp;h=288e3a2ae6b60beb404bf6248e509d9370d6aef1;hb=64803277bbdbe0a943360d918298a48157d9da55;hp=b9099bbd0e80b3a9d0088e4efba902bbf14d633d;hpb=21cf9b6b1843774306a76f4dccddddd706b64f79;p=lttng-tools.git diff --git a/src/common/spawn-viewer.cpp b/src/common/spawn-viewer.cpp index b9099bbd0..288e3a2ae 100644 --- a/src/common/spawn-viewer.cpp +++ b/src/common/spawn-viewer.cpp @@ -3,7 +3,7 @@ * Copyright (C) 2014 Mathieu Desnoyers * Copyright (C) 2020 Francis Deslauriers * - * SPDX-License-Identifier: GPL-2.0-only + * SPDX-License-Identifier: LGPL-2.1-only * */ @@ -14,10 +14,10 @@ #include -#include -#include "error.h" -#include "macros.h" -#include "spawn-viewer.h" +#include +#include "error.hpp" +#include "macros.hpp" +#include "spawn-viewer.hpp" static const char *babeltrace_bin = CONFIG_BABELTRACE_BIN; @@ -85,7 +85,7 @@ static char **alloc_argv_from_user_opts(char *opts, const char *trace_path) } while (*token != '\0'); /* Add two here for the NULL terminating element and trace path */ - argv = (char **) zmalloc(sizeof(char *) * (num_opts + 2)); + argv = calloc(num_opts + 2); if (argv == NULL) { goto error; } @@ -126,7 +126,7 @@ static char **alloc_argv_from_local_opts(const char **opts, size_t opts_len, const char *trace_path, bool opt_live_mode) { char **argv; - size_t size, mem_len; + size_t mem_len; /* Add one for the NULL terminating element. */ mem_len = opts_len + 1; @@ -138,10 +138,7 @@ static char **alloc_argv_from_local_opts(const char **opts, size_t opts_len, mem_len += 1; } - size = sizeof(char *) * mem_len; - - /* Add two here for the trace_path and the NULL terminating element. */ - argv = (char **) zmalloc(size); + argv = calloc(mem_len); if (argv == NULL) { goto error; }