aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/syslog-ng/files/Fix-the-memory-leak-problem-when-HAVE_ENVIRON-defined.patch
blob: 2ac9c0be0f70124aa4446be350e738966136cfd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Fix the memory leak problem when HAVE_ENVIRON is defined

Upstream-Status: Pending

Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
---
--- a/lib/gprocess.c
+++ b/lib/gprocess.c
@@ -1421,6 +1421,18 @@
 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();
 }