Fix length of program_argstring in main.c

This commit is contained in:
Tim Ruehsen 2014-11-28 22:40:19 +01:00
parent 5d3b52d0b8
commit d9325f5db5
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2014-11-28 Tim Ruehsen <tim.ruehsen@gmx.de>
* main.c: Fix length of program_argstring,
fix regression introduced with commit
9217b864d865cf1766e1589d138c8fc17d3d3d5c.
2014-11-28 Tim Ruehsen <tim.ruehsen@gmx.de>
* Makefile.am: Removed gettext.h

View File

@ -1043,8 +1043,8 @@ main (int argc, char **argv)
/* Construct the arguments string. */
for (argstring_length = 1, i = 1; i < argc; i++)
argstring_length += strlen (argv[i]) + 2 + 1;
p = malloc (argstring_length * sizeof (char));
argstring_length += strlen (argv[i]) + 3 + 1;
program_argstring = p = malloc (argstring_length);
if (p == NULL)
{
fprintf (stderr, _("Memory allocation problem\n"));
@ -1062,7 +1062,6 @@ main (int argc, char **argv)
*p++ = ' ';
}
*p = '\0';
program_argstring = p;
/* Load the hard-coded defaults. */
defaults ();