mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-13 08:57:56 -05:00
Merge branch 'lp/http-fetch-pack-index-leak-fix' into jch
A memory leak in `fetch_and_setup_pack_index()` when verification of the downloaded pack index fails has been plugged. Also an obsolete `unlink()` call on parse failure has been cleaned up. * lp/http-fetch-pack-index-leak-fix: http: fix memory leak in fetch_and_setup_pack_index() http: cleanup function fetch_and_setup_pack_index()
This commit is contained in:
10
http.c
10
http.c
@@ -2609,18 +2609,18 @@ static int fetch_and_setup_pack_index(struct packfile_list *packs,
|
||||
|
||||
new_pack = parse_pack_index(the_repository, sha1, tmp_idx);
|
||||
if (!new_pack) {
|
||||
unlink(tmp_idx);
|
||||
free(tmp_idx);
|
||||
|
||||
return -1; /* parse_pack_index() already issued error message */
|
||||
}
|
||||
|
||||
ret = verify_pack_index(new_pack);
|
||||
if (!ret)
|
||||
close_pack_index(new_pack);
|
||||
|
||||
close_pack_index(new_pack);
|
||||
free(tmp_idx);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
free(new_pack);
|
||||
return -1;
|
||||
}
|
||||
|
||||
packfile_list_prepend(packs, new_pack);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user