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

[PATCH] Fix http-fetch

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 29, 2006, 00:10 UTC
Message-ID
<Pine.LNX.4.63.0607290208580.29667@wbgn013.biozentrum.uni-wuerzburg.de>

With the latest changes in fetch.c, http-fetch crashed accessing write_ref[i], where write_ref was NULL.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 fetch.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fetch.c b/fetch.c
index 2151c7b..aeb6bf2 100644
--- a/fetch.c
+++ b/fetch.c
@@ -245,7 +245,7 @@ void pull_targets_free(int targets, char
 {
 	while (targets--) {
 		free(target[targets]);
-		if (write_ref[targets])
+		if (write_ref && write_ref[targets])
 			free((char *) write_ref[targets]);
 	}
 }
@@ -263,7 +263,7 @@ int pull(int targets, char **target, con
 	track_object_refs = 0;
 
 	for (i = 0; i < targets; i++) {
-		if (!write_ref[i])
+		if (!write_ref || !write_ref[i])
 			continue;
 
 		lock[i] = lock_ref_sha1(write_ref[i], NULL, 0);
@@ -295,7 +295,7 @@ int pull(int targets, char **target, con
 		msg = NULL;
 	}
 	for (i = 0; i < targets; i++) {
-		if (!write_ref[i])
+		if (!write_ref || !write_ref[i])
 			continue;
 		ret = write_ref_sha1(lock[i], &sha1[20 * i], msg ? msg : "fetch (unknown)");
 		lock[i] = NULL;
-- 
1.4.2.rc2.g0d86-dirty
Message 1 of 1 in “Fix http-fetch”
  1. Fix http-fetchJohannes Schindelin, Jul 29, 2006

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.