1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

fix a leak on startup from script.c

* libguile/script.c (scm_get_meta_args): Free nargv.  Thanks to
  http://article.gmane.org/gmane.lisp.guile.devel/12685.  We leak narg
  though.
This commit is contained in:
Andy Wingo 2011-07-28 19:12:07 +02:00
parent 7c888dfa6e
commit 2700aa43f2

View file

@ -317,6 +317,7 @@ scm_get_meta_args (int argc, char **argv)
switch (getc (f)) switch (getc (f))
{ {
case EOF: case EOF:
free (nargv);
return 0L; return 0L;
default: default:
continue; continue;
@ -324,6 +325,7 @@ scm_get_meta_args (int argc, char **argv)
goto found_args; goto found_args;
} }
found_args: found_args:
/* FIXME: we leak the result of calling script_read_arg. */
while ((narg = script_read_arg (f))) while ((narg = script_read_arg (f)))
if (!(nargv = (char **) realloc (nargv, if (!(nargv = (char **) realloc (nargv,
(1 + ++nargc) * sizeof (char *)))) (1 + ++nargc) * sizeof (char *))))