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

[PATCH 2/2] daemon: plug memory leak

From
René Scharfe <l.s.r@web.de>
Date
Oct 24, 2015, 12:23 UTC
Message-ID
<562B7838.8050009@web.de>
In-Reply-To
<562B756F.1020305@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 2 of 7 in “run-command: factor out child_process_clear()”
  1. 1/2 run-command: factor out child_process_clear()René Scharfe, Oct 24, 2015
  2. 2/2 daemon: plug memory leakRené Scharfe, Oct 24, 2015
  3. Jeff KingOct 26, 2015
  4. Junio C HamanoOct 26, 2015
  5. Stefan BellerOct 26, 2015
  6. René ScharfeOct 27, 2015
  7. Stefan BellerOct 27, 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.