git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] revision: fix missing null for freed memory
@ 2025-02-08  6:17 Emily M Klassen
  2025-02-08 21:53 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Emily M Klassen @ 2025-02-08  6:17 UTC (permalink / raw)
  To: git; +Cc: Emily M Klassen

"git log --graph --no-graph" missed cleaning up the output_prefix and
output_prefix_data pointers. This resulted in a segfault when using "--patch",
"--name-status" or "--name-only", as the output_prefix_data continued to be in
use after free()

Signed-off-by: Emily M Klassen <forivall@gmail.com>
---
I previously reported this a few hours ago, and ended up digging in and figuring
it out. I'll make sure to bottom reply in the follow ups to this patch.

 revision.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/revision.c b/revision.c
index 474fa1e767..84cb028e11 100644
--- a/revision.c
+++ b/revision.c
@@ -2615,6 +2615,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		graph_clear(revs->graph);
 		revs->graph = graph_init(revs);
 	} else if (!strcmp(arg, "--no-graph")) {
+		revs->diffopt.output_prefix = NULL;
+		revs->diffopt.output_prefix_data = NULL;
 		graph_clear(revs->graph);
 		revs->graph = NULL;
 	} else if (!strcmp(arg, "--encode-email-headers")) {
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-02-13 21:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-08  6:17 [PATCH] revision: fix missing null for freed memory Emily M Klassen
2025-02-08 21:53 ` Junio C Hamano
2025-02-10 16:02 ` Junio C Hamano
2025-02-10 20:56   ` Emily Klassen
2025-02-13  0:42     ` Junio C Hamano
2025-02-11  7:55 ` Patrick Steinhardt
2025-02-11 19:31   ` D. Ben Knoble
2025-02-11 20:22     ` D. Ben Knoble
2025-02-11 21:29       ` Jeff King
2025-02-11 23:09         ` Junio C Hamano
2025-02-12  5:30         ` Patrick Steinhardt
2025-02-13 21:07         ` Ben Knoble

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).