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

[PATCH 1/3] log: fix memory leak if --graph is passed multiple times

From
Alex Henrie <alexhenrie24@gmail.com>
Date
Feb 9, 2022, 16:23 UTC
Message-ID
<20220209162350.169971-1-alexhenrie24@gmail.com>
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
 revision.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/revision.c b/revision.c
index ad4286fbdd..c03c387edd 100644
--- a/revision.c
+++ b/revision.c
@@ -2424,9 +2424,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		revs->pretty_given = 1;
 		revs->abbrev_commit = 1;
 	} else if (!strcmp(arg, "--graph")) {
-		revs->topo_order = 1;
-		revs->rewrite_parents = 1;
-		revs->graph = graph_init(revs);
+		if (!revs->graph) {
+			revs->topo_order = 1;
+			revs->rewrite_parents = 1;
+			revs->graph = graph_init(revs);
+		}
 	} else if (!strcmp(arg, "--encode-email-headers")) {
 		revs->encode_email_headers = 1;
 	} else if (!strcmp(arg, "--no-encode-email-headers")) {
-- 
2.32.0.2645.gc109162a1f
Next: Alex Henrie
Message 1 of 9 in “log: fix memory leak if --graph is passed multiple times”
  1. 1/3 log: fix memory leak if --graph is passed multiple timesAlex Henrie, Feb 9, 2022
  2. 2/3 log: add a config option for --graphAlex Henrie, Feb 9, 2022
  3. Junio C HamanoFeb 9, 2022
  4. Alex HenrieFeb 10, 2022
  5. 3/3 gitk: set log.graph=false when running `git log`Alex Henrie, Feb 9, 2022
  6. Junio C HamanoFeb 9, 2022
  7. Alex HenrieFeb 10, 2022
  8. Junio C HamanoFeb 10, 2022
  9. Junio C HamanoFeb 9, 2022

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.