14 Apr
2014
14 Apr
'14
7:24 a.m.
These memories are allocated in g_process_set_argv_space() when HAVE_ENVIRON is defined, but are not freed anywhere. Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com> --- lib/gprocess.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/lib/gprocess.c b/lib/gprocess.c index 9053bc9..6cc0b1f 100644 --- a/lib/gprocess.c +++ b/lib/gprocess.c @@ -1433,6 +1433,19 @@ g_process_startup_ok(void) void g_process_finish(void) { +#ifdef HAVE_ENVIRON + int i = 0; + + while (environ[i]) + { + g_free(environ[i]); + ++i; + } + if (environ) + g_free(environ); + if (process_opts.argv_orig) + free(process_opts.argv_orig); +#endif g_process_remove_pidfile(); } -- 1.7.0.2