Thread (98 messages) flat view 98 messages, 7 authors, 2d ago

Re* [PATCH v10 4/4] hook: introduce the receive-report hook

From: Junio C Hamano <hidden>
Date: 2026-09-14 22:36:08
Subsystem: the rest · Maintainer: Linus Torvalds

Karthik Nayak [off-list ref] writes:
I could send in this patch for coccinelle with the fixup if that's okay
with you.
This patch until it gets fixed will take the coccinelle updates
hostage, so let's queue the following on top before merging it down
to 'next'.

----- >8 -----
Subject: [PATCH] receive-pack: coccinelle fix

Let's not check the nullness of cmd->error_string_owned before
calling FREE_AND_NULL(cmd->error_string_owned).  It is cheap and
safe to call FREE_AND_NULL(variable) for a variable that has NULL
in it.

Signed-off-by: Junio C Hamano <redacted>
---
 builtin/receive-pack.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 9ac7717096..1d5b050beb 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -2452,8 +2452,7 @@ static void update_shallow_info(struct command *commands,
 static void override_cmds_error(struct command *commands, const char *err)
 {
 	for (struct command *cmd = commands; cmd; cmd = cmd->next) {
-		if (cmd->error_string_owned)
-			FREE_AND_NULL(cmd->error_string_owned);
+		FREE_AND_NULL(cmd->error_string_owned);
 		cmd->error_string = err;
 	}
 }
-- 
2.56.0-rc0-195-g1e3108ffbb
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help