Commit c92abe7
builtin/fetch: fix leaking transaction with
With the `--atomic` flag, we use a single ref transaction to commit all
ref updates in git-fetch(1). The lifetime of transactions is somewhat
weird: while `ref_transaction_abort()` will free the transaction, a call
to `ref_transaction_commit()` won't. We thus have to manually free the
transaction in the successful case.
Adapt the code to free the transaction in the exit path to plug the
resulting memory leak. As `ref_transaction_abort()` already freed the
transaction for us, we have to unset the transaction when we hit that
code path to not cause a double free.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>--atomic
1 parent 8960819 commit c92abe7
2 files changed
+5
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1731 | 1731 | | |
1732 | 1732 | | |
1733 | 1733 | | |
1734 | | - | |
1735 | | - | |
1736 | | - | |
| 1734 | + | |
1737 | 1735 | | |
1738 | | - | |
1739 | 1736 | | |
1740 | 1737 | | |
1741 | 1738 | | |
| |||
1803 | 1800 | | |
1804 | 1801 | | |
1805 | 1802 | | |
| 1803 | + | |
1806 | 1804 | | |
1807 | 1805 | | |
| 1806 | + | |
| 1807 | + | |
1808 | 1808 | | |
1809 | 1809 | | |
1810 | 1810 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments