Replace calloc(3) with malloc(3), and set the tail of the
argument list to NULL, to terminate the arguments passed to execvp(2). Thanks to: bde (for pointing out some missing parens) And with apologies to Ozzy Osbourne: On his way to dinner It took him by surprise When an email from bde Said his code was full of lies Style (indentation) And his bracing were all wrong He casted to size_t When he should have cast to long I don't mind Single letter identifiers Unwrapped Line Over 80 chars Far over 80 chars Who can we get to send diffs We need Bruce D. Evans Shows you comparason to his We need Bruce D. Evans again
This commit is contained in:
parent
a39ed8234a
commit
b6594dba8b
@ -380,9 +380,9 @@ prerun(int argc, char **argv, int repls, const char *replstr, char **xp, char **
|
||||
* Allocate memory to hold the argument list, and
|
||||
* a NULL at the tail.
|
||||
*/
|
||||
tmp = calloc(argc + 1, sizeof(char**));
|
||||
tmp = malloc((argc + 1) * sizeof(char**));
|
||||
if (tmp == NULL)
|
||||
err(1, "calloc");
|
||||
err(1, "malloc");
|
||||
tmp2 = tmp;
|
||||
|
||||
/*
|
||||
@ -415,6 +415,7 @@ prerun(int argc, char **argv, int repls, const char *replstr, char **xp, char **
|
||||
/*
|
||||
* Run it.
|
||||
*/
|
||||
*tmp = NULL;
|
||||
run(tmp2);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user