argv.c (dupargv): Mallocate space of argv[argc], not sizeof(char *) of that amuont.

* argv.c (dupargv): Mallocate space of argv[argc], not
	sizeof(char *) of that amuont.  Cast result to char *.

From-SVN: r98083
This commit is contained in:
Gabriel Dos Reis 2005-04-13 13:49:19 +00:00 committed by Gabriel Dos Reis
parent 5782c29da3
commit 0e0af50b89
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-04-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
* argv.c (dupargv): Mallocate space of argv[argc], not
sizeof(char *) of that amuont. Cast result to char *.
2005-04-12 Gabriel Dos Reis <gdr@integrable-solutions.net>
* regex.c (wcs_re_match_2_internal, byte_re_match_2_internal):

View File

@ -77,7 +77,7 @@ dupargv (char **argv)
for (argc = 0; argv[argc] != NULL; argc++)
{
int len = strlen (argv[argc]);
copy[argc] = malloc (sizeof (char *) * (len + 1));
copy[argc] = (char *) malloc (len + 1);
if (copy[argc] == NULL)
{
freeargv (copy);