Skip to content

Commit 1e49f12

Browse files
committed
Fix a possible null pointer dereference
This change fixes a possible null pointer dereference if anything inside `git_commit_graph_writer_add_index_file` fails before the packfile being valid. https://scan6.coverity.com/reports.htm#v52218/p10377/fileInstanceId=122935896&defectInstanceId=32525576&mergedDefectId=1461634
1 parent c811fc3 commit 1e49f12

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/commit_graph.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,8 @@ int git_commit_graph_writer_add_index_file(
716716
goto cleanup;
717717

718718
cleanup:
719-
git_mwindow_put_pack(p);
719+
if (p)
720+
git_mwindow_put_pack(p);
720721
git_odb_free(state.db);
721722
return error;
722723
}

0 commit comments

Comments
 (0)