diff options
author | lhchavez <lhchavez@lhchavez.com> | 2021-08-31 05:23:20 -0700 |
---|---|---|
committer | lhchavez <lhchavez@lhchavez.com> | 2021-08-31 05:23:20 -0700 |
commit | 1e49f12793c4d39fffb64a08db0d1fddafaf0338 (patch) | |
tree | fc09c9049477ebfb9efba5866088c7a5174f6798 | |
parent | c811fc361be92226eec463f92e33d838fa0e9d54 (diff) | |
download | libgit2-1e49f12793c4d39fffb64a08db0d1fddafaf0338.tar.gz |
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
-rw-r--r-- | src/commit_graph.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/commit_graph.c b/src/commit_graph.c index 9abe373da..71e415e99 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; } |