diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-09-03 09:14:59 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-09-03 09:15:00 -0700 |
| commit | 8c1c63d5256edd900200b7f056a946f38c89495d (patch) | |
| tree | 5a894009e6419ca2ba29ba2031067b457f8bfaba /builtin/fetch.c | |
| parent | Merge branch 'cl/config-regexp-docfix' (diff) | |
| parent | transport: fix leaking negotiation tips (diff) | |
| download | git-8c1c63d5256edd900200b7f056a946f38c89495d.tar.gz git-8c1c63d5256edd900200b7f056a946f38c89495d.zip | |
Merge branch 'ps/leakfixes-part-5'
Even more leak fixes.
* ps/leakfixes-part-5:
transport: fix leaking negotiation tips
transport: fix leaking arguments when fetching from bundle
builtin/fetch: fix leaking transaction with `--atomic`
remote: fix leaking peer ref when expanding refmap
remote: fix leaks when matching refspecs
remote: fix leaking config strings
builtin/fetch-pack: fix leaking refs
sideband: fix leaks when configuring sideband colors
builtin/send-pack: fix leaking refspecs
transport: fix leaking OID arrays in git:// transport data
t/helper: fix leaking multi-pack-indices in "read-midx"
builtin/repack: fix leaks when computing packs to repack
midx-write: fix leaking hashfile on error cases
builtin/archive: fix leaking `OPT_FILENAME()` value
builtin/upload-archive: fix leaking args passed to `write_archive()`
builtin/merge-tree: fix leaking `-X` strategy options
pretty: fix leaking key/value separator buffer
pretty: fix memory leaks when parsing pretty formats
convert: fix leaks when resetting attributes
mailinfo: fix leaking header data
Diffstat (limited to 'builtin/fetch.c')
| -rw-r--r-- | builtin/fetch.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index c297569a47..0264483c0e 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1731,11 +1731,8 @@ static int do_fetch(struct transport *transport, goto cleanup; retcode = ref_transaction_commit(transaction, &err); - if (retcode) { - ref_transaction_free(transaction); - transaction = NULL; + if (retcode) goto cleanup; - } } commit_fetch_head(&fetch_head); @@ -1803,8 +1800,11 @@ cleanup: if (transaction && ref_transaction_abort(transaction, &err) && err.len) error("%s", err.buf); + transaction = NULL; } + if (transaction) + ref_transaction_free(transaction); display_state_release(&display_state); close_fetch_head(&fetch_head); strbuf_release(&err); |
