[Chilli] [PATCH] Fix: Memory leak of opt_run()

Masashi Honma honma at ictec.co.jp
Fri Mar 5 06:45:34 UTC 2010


(2010/03/05 15:38), Masashi Honma wrote:
> static int opt_run(int argc, char **argv, int reload) {
> char **newargs;
> char file[128];
>
> newargs_bk = newargs; <-- add


I omitted many lines. Right position is here.

   if (!(newargs = calloc(1, sizeof(char *) * (argc + 4)))) {
     return -1;
   }

   newargs_bk = newargs; <-- add

   for (i=1; i < argc; i++) {
     newargs[i] = argv[i];
   }

Regards,
Masashi Honma.


More information about the Chilli mailing list