Commit 0c52cf8
sequencer: add a "goto cleanup" to do_reset()
Restructure code that's mostly added in 9055e40 (sequencer:
introduce new commands to reset the revision, 2018-04-25) to avoid
code duplication, and to make freeing other resources easier in a
subsequent commit.
It's safe to initialize "tree_desc" to be zero'd out in order to
unconditionally free desc.buffer, it won't be initialized on the first
couple of "goto"'s.
There are three earlier "return"'s in this function which should
probably be made to use this new "cleanup" too, per [1] it looks like
they're leaving behind stale locks. But let's not try to fix every
potential bug here now, I'm just trying to narrowly plug a memory
leak.
1. https://lore.kernel.org/git/CABPp-BH=3DP-dXRCphY53-3eZd1TU8h5GY_M12nnbEGm-UYB9Q@mail.gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent e5a917f commit 0c52cf8
1 file changed
+13
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3644 | 3644 | | |
3645 | 3645 | | |
3646 | 3646 | | |
3647 | | - | |
| 3647 | + | |
3648 | 3648 | | |
3649 | 3649 | | |
3650 | 3650 | | |
| |||
3678 | 3678 | | |
3679 | 3679 | | |
3680 | 3680 | | |
3681 | | - | |
3682 | | - | |
3683 | | - | |
3684 | | - | |
| 3681 | + | |
| 3682 | + | |
3685 | 3683 | | |
3686 | 3684 | | |
3687 | 3685 | | |
| |||
3696 | 3694 | | |
3697 | 3695 | | |
3698 | 3696 | | |
3699 | | - | |
3700 | | - | |
3701 | | - | |
| 3697 | + | |
| 3698 | + | |
3702 | 3699 | | |
3703 | 3700 | | |
3704 | 3701 | | |
3705 | | - | |
3706 | | - | |
3707 | | - | |
3708 | | - | |
3709 | | - | |
| 3702 | + | |
| 3703 | + | |
3710 | 3704 | | |
3711 | 3705 | | |
3712 | 3706 | | |
3713 | | - | |
3714 | | - | |
3715 | | - | |
3716 | | - | |
| 3707 | + | |
| 3708 | + | |
3717 | 3709 | | |
3718 | 3710 | | |
3719 | 3711 | | |
3720 | 3712 | | |
3721 | 3713 | | |
3722 | 3714 | | |
3723 | 3715 | | |
3724 | | - | |
3725 | 3716 | | |
3726 | 3717 | | |
3727 | 3718 | | |
3728 | 3719 | | |
3729 | 3720 | | |
3730 | | - | |
| 3721 | + | |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
3731 | 3725 | | |
3732 | 3726 | | |
3733 | 3727 | | |
| |||
0 commit comments