[Chilli] [PATCH] Fix: Memory leak of opt_run()
Masashi Honma
honma at ictec.co.jp
Fri Mar 5 08:57:33 UTC 2010
(2010/03/05 17:08), David Bird wrote:
> Hello,
>
> I still don't see the problem.
Have you tested as I wrote ?
> In opt_run(), one of the first things it
> does is a fork() and returns the parent process out of the function. The
> child continues, and allocated the memory in question, before going into
> execv(), which replaces the process. I believe your free(newargs_bk) in
> options_destroy() is trying to free uninitialized memory (newargs_bk
> isn't initialized in the parent, only the child).
No. I printed out the address of newargs just after calloc(). And I
printed out the address of newargs_bk just before free(newargs_bk) in
options_destroy(). They have identical address.
> So, the question is,
> do you think memory is being leaked in the parent or child process? I
> would only be concerned about leaking memory in the parent (chilli)
> process as the child process is short-lived.
Do you think the newargs is freed when the child process finished ?
If so, why free() in options_destroy() doesn't cause double free
warning in my previous test code ?
Regards,
Masashi Honma.
More information about the Chilli
mailing list