Commit 1e49f127 by lhchavez

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
parent c811fc36
...@@ -716,7 +716,8 @@ int git_commit_graph_writer_add_index_file( ...@@ -716,7 +716,8 @@ int git_commit_graph_writer_add_index_file(
goto cleanup; goto cleanup;
cleanup: cleanup:
git_mwindow_put_pack(p); if (p)
git_mwindow_put_pack(p);
git_odb_free(state.db); git_odb_free(state.db);
return error; return error;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment