Thread (1 message) 1 message, 1 author, 2021-10-21

Re: [PATCH 1/6] grep: prefer "struct grep_opt" over its "void *"

From: Junio C Hamano <hidden>
Date: 2021-10-21 23:52:21

Ævar Arnfjörð Bjarmason  [off-list ref] writes:
Subject: Re: [PATCH 1/6] grep: prefer "struct grep_opt" over its "void *"
I sense an incomplete sentence.  "counterpart" or "equivalent" is
missing at the tail, perhaps?
Stylistically fix up code added in bfac23d9534 (grep: Fix two memory
leaks, 2010-01-30). We usually don't use the "arg" at all once we've
unpacked it into the struct we want, let's not do that here when we're
As we do not unpack and instead take it as a whole and cast, "we've
unpacked it into" -> "we've casted it to".



quoted hunk
freeing it. Perhaps it was thought that a cast to "void *" would
otherwise be needed?

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/grep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index 8af5249a7bb..fd184c182a3 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -199,8 +199,8 @@ static void *run(void *arg)
 		grep_source_clear_data(&w->source);
 		work_done(w);
 	}
-	free_grep_patterns(arg);
-	free(arg);
+	free_grep_patterns(opt);
+	free(opt);
 
 	return (void*) (intptr_t) hit;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help