diff --git a/os/client.c b/os/client.c index aa9be849c..fbccf22ed 100644 --- a/os/client.c +++ b/os/client.c @@ -234,13 +234,7 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs) /* Contruct the process name without arguments. */ if (cmdname) { - char *name = malloc(cmdsize); - if (name) - { - strncpy(name, path, cmdsize); - name[cmdsize - 1] = '\0'; - *cmdname = name; - } + *cmdname = strdup(path); } /* Construct the arguments for client process. */