summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2006-10-09 16:35:02 +0000
committerDave Mitchell <davem@fdisolutions.com>2006-10-09 16:35:02 +0000
commit15db3ae289ff45bb22c7aa4fbfecdc85d7503321 (patch)
tree0a8fac124a55ba035459b9127398359c5a65a3ef /doio.c
parent1b9a72a9dfc4967e4463f087bcdbe76648d6654c (diff)
downloadperl-15db3ae289ff45bb22c7aa4fbfecdc85d7503321.tar.gz
fix bad free in do_exec3()
p4raw-id: //depot/perl@28975
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/doio.c b/doio.c
index e6909cb351..6afb89bcca 100644
--- a/doio.c
+++ b/doio.c
@@ -1447,11 +1447,13 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
dVAR;
register char **a;
register char *s;
+ char *buf;
char *cmd;
/* Make a copy so we can change it */
const Size_t cmdlen = strlen(incmd) + 1;
- Newx(cmd, cmdlen, char);
+ Newx(buf, cmdlen, char);
+ cmd = buf;
my_strlcpy(cmd, incmd, cmdlen);
while (*cmd && isSPACE(*cmd))
@@ -1486,7 +1488,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
PERL_FPU_POST_EXEC
*s = '\'';
S_exec_failed(aTHX_ PL_cshname, fd, do_report);
- Safefree(cmd);
+ Safefree(buf);
return FALSE;
}
}
@@ -1534,7 +1536,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
PerlProc_execl(PL_sh_path, "sh", "-c", cmd, (char *)NULL);
PERL_FPU_POST_EXEC
S_exec_failed(aTHX_ PL_sh_path, fd, do_report);
- Safefree(cmd);
+ Safefree(buf);
return FALSE;
}
}
@@ -1564,7 +1566,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
S_exec_failed(aTHX_ PL_Argv[0], fd, do_report);
}
do_execfree();
- Safefree(cmd);
+ Safefree(buf);
return FALSE;
}