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

[PATCH] get_indexed_object can return NULL if nothing is in that slot; check for it

From
Brian Harring <ferringb@gmail.com>
Date
Aug 24, 2011, 05:47 UTC
Message-ID
<20110824054717.GA16512@localhost>

This fixes a segfault introduced by 051e400; via it, no longer able to trigger the http/smartserv race.

Signed-off-by: Brian Harring <ferringb@gmail.com>
---
 upload-pack.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/upload-pack.c b/upload-pack.c
index 6420918..8739bfa 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -533,6 +533,8 @@ static void check_non_tip(void)
 	namebuf[41] = '\n';
 	for (i = get_max_object_index(); 0 < i; ) {
 		o = get_indexed_object(--i);
+		if (!o)
+			continue;
 		if (!(o->flags & OUR_REF))
 			continue;
 		memcpy(namebuf + 1, sha1_to_hex(o->sha1), 40);
-- 
1.7.6
Next: Junio C Hamano
Message 1 of 4 in “get_indexed_object can return NULL if nothing is in that slot; check for it”
  1. get_indexed_object can return NULL if nothing is in that slot; check for itBrian Harring, Aug 24, 2011
  2. Junio C HamanoAug 24, 2011
  3. Brian HarringAug 24, 2011
  4. Junio C HamanoAug 24, 2011

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.