git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] parse_object: check if buffer is non-NULL before freeing it
@ 2006-08-28  0:31 Jonas Fonseca
  2006-08-28  4:20 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Fonseca @ 2006-08-28  0:31 UTC (permalink / raw)
  To: git

Two code paths may cause this and other places in the source have the
courtesy to do the check.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
 object.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/object.c b/object.c
index 9281300..c08347f 100644
--- a/object.c
+++ b/object.c
@@ -173,7 +173,8 @@ struct object *parse_object(const unsign
 		} else {
 			obj = NULL;
 		}
-		free(buffer);
+		if (buffer)
+			free(buffer);
 		return obj;
 	}
 	return NULL;
-- 
1.4.2.g2f76-dirty

-- 
Jonas Fonseca

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

end of thread, other threads:[~2006-08-28  5:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-28  0:31 [PATCH] parse_object: check if buffer is non-NULL before freeing it Jonas Fonseca
2006-08-28  4:20 ` Junio C Hamano
2006-08-28  4:33   ` Linus Torvalds
2006-08-28  5:46     ` Junio C Hamano

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).