summaryrefslogtreecommitdiff
path: root/source3/lib/smbrun.c
diff options
context:
space:
mode:
authortodd stecher <todd.stecher@gmail.com>2009-02-09 13:25:59 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-02-10 14:43:14 -0800
commit9d4d2f70cbf83919a11c194c8234de269c5d91ee (patch)
treea8379f0ebb9a6d23f78109e1beb57541b279cbd2 /source3/lib/smbrun.c
parentfdd282afa3e80712790c5bbac84bf4f88644692a (diff)
downloadsamba-9d4d2f70cbf83919a11c194c8234de269c5d91ee.tar.gz
samba-9d4d2f70cbf83919a11c194c8234de269c5d91ee.tar.bz2
samba-9d4d2f70cbf83919a11c194c8234de269c5d91ee.zip
S3: Fixes for coverity issues.
Diffstat (limited to 'source3/lib/smbrun.c')
-rw-r--r--source3/lib/smbrun.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c
index 31990713b8..fdccd9ec97 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 */