aboutsummaryrefslogtreecommitdiffstats
path: root/shallow.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-10-02 07:46:26 -0700
committerJunio C Hamano <gitster@pobox.com>2024-10-02 07:46:26 -0700
commit59ee4f70136a12feb47979ca90baaf7c7beafe73 (patch)
tree06d69eaa4a69f974b284f6a71df1fbb8319d0144 /shallow.c
parent365529e1ea19b44a7a253b780f3ae3a1cb2f081f (diff)
parentf4c768c639566da07fc063fa9b52607f54ac94ee (diff)
downloadgit-59ee4f70136a12feb47979ca90baaf7c7beafe73.tar.gz
Merge branch 'jk/http-leakfixes'
Leakfixes. * jk/http-leakfixes: (28 commits) http-push: clean up local_refs at exit http-push: clean up loose request when falling back to packed http-push: clean up objects list http-push: free xml_ctx.cdata after use http-push: free remote_ls_ctx.dentry_name http-push: free transfer_request strbuf http-push: free transfer_request dest field http-push: free curl header lists http-push: free repo->url string http-push: clear refspecs before exiting http-walker: free fake packed_git list remote-curl: free HEAD ref with free_one_ref() http: stop leaking buffer in http_get_info_packs() http: call git_inflate_end() when releasing http_object_request http: fix leak of http_object_request struct http: fix leak when redacting cookies from curl trace transport-helper: fix leak of dummy refs_list fetch-pack: clear pack lockfiles list fetch: free "raw" string when shrinking refspec transport-helper: fix strbuf leak in push_refs_with_push() ...
Diffstat (limited to 'shallow.c')
-rw-r--r--shallow.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/shallow.c b/shallow.c
index dcebc263d7..4bb1518dbc 100644
--- a/shallow.c
+++ b/shallow.c
@@ -51,12 +51,11 @@ int unregister_shallow(const struct object_id *oid)
int pos = commit_graft_pos(the_repository, oid);
if (pos < 0)
return -1;
- if (pos + 1 < the_repository->parsed_objects->grafts_nr) {
- free(the_repository->parsed_objects->grafts[pos]);
+ free(the_repository->parsed_objects->grafts[pos]);
+ if (pos + 1 < the_repository->parsed_objects->grafts_nr)
MOVE_ARRAY(the_repository->parsed_objects->grafts + pos,
the_repository->parsed_objects->grafts + pos + 1,
the_repository->parsed_objects->grafts_nr - pos - 1);
- }
the_repository->parsed_objects->grafts_nr--;
return 0;
}