[PATCH] parse_object: check if buffer is non-NULL before freeing it

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jonas Fonseca
Date: Sunday, August 27, 2006 - 5:31 pm

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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] parse_object: check if buffer is non-NULL before f ..., Jonas Fonseca, (Sun Aug 27, 5:31 pm)