summaryrefslogtreecommitdiffstats
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-11-22 06:34:17 +0100
committerJunio C Hamano <gitster@pobox.com>2024-11-22 06:34:17 +0100
commitaa1d4b42e51373e87f9d5bb0ede4c2e522a74319 (patch)
treeb0eafc4ff71a66c4848ccf4b0b481f8140f27afb /builtin/fetch.c
parentMerge branch 'jk/test-malloc-debug-check' (diff)
parentrefspec: store raw refspecs inside refspec_item (diff)
downloadgit-aa1d4b42e51373e87f9d5bb0ede4c2e522a74319.tar.xz
git-aa1d4b42e51373e87f9d5bb0ede4c2e522a74319.zip
Merge branch 'jk/fetch-prefetch-double-free-fix'
Double-free fix. * jk/fetch-prefetch-double-free-fix: refspec: store raw refspecs inside refspec_item refspec: drop separate raw_nr count fetch: adjust refspec->raw_nr when filtering prefetch refspecs
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 18eff4e5fa..06b4611958 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -454,14 +454,10 @@ static void filter_prefetch_refspec(struct refspec *rs)
ref_namespace[NAMESPACE_TAGS].ref))) {
int j;
- free(rs->items[i].src);
- free(rs->items[i].dst);
- free(rs->raw[i]);
+ refspec_item_clear(&rs->items[i]);
- for (j = i + 1; j < rs->nr; j++) {
+ for (j = i + 1; j < rs->nr; j++)
rs->items[j - 1] = rs->items[j];
- rs->raw[j - 1] = rs->raw[j];
- }
rs->nr--;
i--;
continue;