git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 3/3] daemon: plug memory leak

From
René Scharfe <l.s.r@web.de>
Date
Oct 31, 2015, 09:20 UTC
Message-ID
<563487F4.6080403@web.de>
In-Reply-To
<56348709.9080207@web.de>

Call child_process_clear() when a child ends to release the memory allocated for its environment. This is necessary because unlike all other users of start_command() we don't call finish_command(), which would have taken care of that for us.

This leak was introduced by f063d38b (daemon: use cld->env_array when re-spawning).

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 daemon.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/daemon.c b/daemon.c
index 56679a1..be70cd4 100644
--- a/daemon.c
+++ b/daemon.c
@@ -802,6 +802,7 @@ static void check_dead_children(void)
 			/* remove the child */
 			*cradle = blanket->next;
 			live_children--;
+			child_process_clear(&blanket->cld);
 			free(blanket);
 		} else
 			cradle = &blanket->next;
-- 
2.6.2
Previous: René ScharfeNext: Jeff King
Message 4 of 6 in “daemon: plug memory leak”
  1. 0/3 daemon: plug memory leakRené Scharfe, Oct 31, 2015
  2. 1/3 run-command: name the cleanup function child_process_clear()René Scharfe, Oct 31, 2015
  3. 2/3 run-command: export child_process_clear()René Scharfe, Oct 31, 2015
  4. 3/3 daemon: plug memory leakRené Scharfe, Oct 31, 2015
  5. Jeff KingOct 31, 2015
  6. Stefan BellerOct 31, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.