From 9d4d2f70cbf83919a11c194c8234de269c5d91ee Mon Sep 17 00:00:00 2001 From: todd stecher Date: Mon, 9 Feb 2009 13:25:59 -0800 Subject: S3: Fixes for coverity issues. --- source3/lib/smbrun.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c index 31990713b88..fdccd9ec976 100644 --- a/source3/lib/smbrun.c +++ b/source3/lib/smbrun.c @@ -183,11 +183,17 @@ static int smbrun_internal(const char *cmd, int *outfd, bool sanitize) #endif { - const char *newcmd = sanitize ? escape_shell_string(cmd) : cmd; - if (!newcmd) { - exit(82); + char *newcmd = NULL; + if (sanitize) { + newcmd = escape_shell_string(cmd); + if (!newcmd) + exit(82); } - execl("/bin/sh","sh","-c",newcmd,NULL); + + execl("/bin/sh","sh","-c", + newcmd ? (const char *)newcmd : cmd, NULL); + + SAFE_FREE(newcmd); } /* not reached */ -- cgit