Commit d56b4079e0474b2f96abe0487a44359970e43c2a

Edward Thomson 2021-08-31T09:21:22

Merge pull request #6024 from lhchavez/fix-possible-null-pointer-dereference Fix a possible null pointer dereference

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/commit_graph.c b/src/commit_graph.c
index 9abe373..71e415e 100644
--- a/src/commit_graph.c
+++ b/src/commit_graph.c
@@ -716,7 +716,8 @@ int git_commit_graph_writer_add_index_file(
 		goto cleanup;
 
 cleanup:
-	git_mwindow_put_pack(p);
+	if (p)
+		git_mwindow_put_pack(p);
 	git_odb_free(state.db);
 	return error;
 }