From: Dave Mitchell Date: Mon, 9 Oct 2006 16:35:02 +0000 (+0000) Subject: fix bad free in do_exec3() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=15db3ae289ff45bb22c7aa4fbfecdc85d7503321;p=p5sagit%2Fp5-mst-13.2.git fix bad free in do_exec3() p4raw-id: //depot/perl@28975 --- diff --git a/doio.c b/doio.c index e6909cb..6afb89b 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; }