fix a leak on startup from script.c
authorAndy Wingo <wingo@pobox.com>
Thu, 28 Jul 2011 17:12:07 +0000 (19:12 +0200)
committerAndy Wingo <wingo@pobox.com>
Fri, 29 Jul 2011 07:10:37 +0000 (09:10 +0200)
* libguile/script.c (scm_get_meta_args): Free nargv.  Thanks to
  http://article.gmane.org/gmane.lisp.guile.devel/12685.  We leak narg
  though.

libguile/script.c

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