Commit b63b3b0e4df81174a323ff6b1b4450014502e9b7

Jacques Germishuys 2015-01-25T14:08:05

Ensure git_index_entry is not NULL before trying to free it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/index.c b/src/index.c
index 079b0cb..cbace36 100644
--- a/src/index.c
+++ b/src/index.c
@@ -292,6 +292,9 @@ static void index_entry_reuc_free(git_index_reuc_entry *reuc)
 
 static void index_entry_free(git_index_entry *entry)
 {
+	if (!entry)
+		return;
+
 	memset(&entry->id, 0, sizeof(entry->id));
 	git__free(entry);
 }