summaryrefslogtreecommitdiffstats
path: root/lib/util/util_runcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util/util_runcmd.c')
-rw-r--r--lib/util/util_runcmd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/util/util_runcmd.c b/lib/util/util_runcmd.c
index bc5cc10a8b..c8547de694 100644
--- a/lib/util/util_runcmd.c
+++ b/lib/util/util_runcmd.c
@@ -204,13 +204,16 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
va_start(ap, argv0);
while (1) {
+ const char **l;
char *arg = va_arg(ap, char *);
if (arg == NULL) break;
- argv = discard_const_p(char *, str_list_add((const char **)argv, arg));
- if (!argv) {
+ l = discard_const_p(const char *, argv);
+ l = str_list_add(l, arg);
+ if (l == NULL) {
fprintf(stderr, "Out of memory in child\n");
_exit(255);
}
+ argv = discard_const_p(char *, l);
}
va_end(ap);