revisions API users: use release_revisions() in http-push.c

In the case of cmd_main() in http-push.c we need to move the deceleration of the "struct rev-list" into the loop over the "remote_refs" when adding a release_revisions(). We'd previously set up the "revs" for each remote, but would potentially leak memory on each one. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Apr 13, 2022 at 22:01 UTC b78ce337def2db3a6fceee157f49202e5d1ce46a
1 file changed +2 -1
http-push.c
+2 -1
@@ -1689,7 +1689,6 @@ int cmd_main(int argc, const char **argv)
1689 struct refspec rs = REFSPEC_INIT_PUSH;
1690 struct remote_lock *ref_lock = NULL;
1691 struct remote_lock *info_ref_lock = NULL;
1692 - struct rev_info revs;
1692 int delete_branch = 0;
1693 int force_delete = 0;
1694 int objects_to_send;
@@ -1825,6 +1824,7 @@ int cmd_main(int argc, const char **argv)
1824
1825 new_refs = 0;
1826 for (ref = remote_refs; ref; ref = ref->next) {
1827 + struct rev_info revs;
1828 struct strvec commit_argv = STRVEC_INIT;
1829
1830 if (!ref->peer_ref)
@@ -1941,6 +1941,7 @@ int cmd_main(int argc, const char **argv)
1941 unlock_remote(ref_lock);
1942 check_locks();
1943 strvec_clear(&commit_argv);
1944 + release_revisions(&revs);
1945 }
1946
1947 /* Update remote server info if appropriate */