aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-06-17 10:44:41 -0700
committerJunio C Hamano <gitster@pobox.com>2025-06-17 10:44:41 -0700
commit5e22d03832742362ad83733f838e645aba9c9bb4 (patch)
treea67c7605e6a6fc8c24648d8f8a5c443a3d9cc762 /builtin
parentb5a135b1f7a26bcceb047fde01cd52029a0a8285 (diff)
parentaedebdb6b99af5fb5a61ae1359c1ed3a7b55135c (diff)
downloadgit-5e22d03832742362ad83733f838e645aba9c9bb4.tar.gz
Merge branch 'ly/fetch-pack-leakfix'
A memory-leak in an error code path has been plugged. * ly/fetch-pack-leakfix: builtin/fetch-pack: cleanup before return error
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fetch-pack.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index d07eec9e55..d9e42bad58 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -274,8 +274,10 @@ int cmd_fetch_pack(int argc,
}
close(fd[0]);
close(fd[1]);
- if (finish_connect(conn))
- return 1;
+ if (finish_connect(conn)) {
+ ret = 1;
+ goto cleanup;
+ }
ret = !fetched_refs;
@@ -291,6 +293,7 @@ int cmd_fetch_pack(int argc,
printf("%s %s\n",
oid_to_hex(&ref->old_oid), ref->name);
+cleanup:
for (size_t i = 0; i < nr_sought; i++)
free_one_ref(sought_to_free[i]);
free(sought_to_free);