X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fspawn-viewer.cpp;h=288e3a2ae6b60beb404bf6248e509d9370d6aef1;hb=64803277bbdbe0a943360d918298a48157d9da55;hp=fe11587130be8961da27c4e0484dab8d328bfd9e;hpb=60f1b42d6280b6bd386abb726dca4fd3b31d8491;p=lttng-tools.git diff --git a/src/common/spawn-viewer.cpp b/src/common/spawn-viewer.cpp index fe1158713..288e3a2ae 100644 --- a/src/common/spawn-viewer.cpp +++ b/src/common/spawn-viewer.cpp @@ -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; }