diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index ad290007363..40f87b4649a 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -193,7 +193,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
 	unsigned char sha1[20];
 	enum object_type type = 0;
 	unsigned long size;
-	void *contents;
+	void *contents = NULL;
 
 	if (!obj_name)
 	   return 1;