Commit 0c99bd7
phar: call phar_entry_delref before goto finish in phar_add_file error paths
phar_add_file opens or creates an entry via phar_get_or_create_entry_data_rw,
which increments the entry's reference count and must be balanced by a
phar_entry_delref call. Two error paths inside the content-write block
jumped to finish: with goto, skipping the phar_entry_delref at line 3714.
The finish: label comes after the delref, so both paths leaked the entry
reference.
Add phar_entry_delref(data) before each goto finish in the short-write and
missing-resource branches.
Closes GH-21798
Closes GH-218031 parent b9aaa05 commit 0c99bd7
2 files changed
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3684 | 3684 | | |
3685 | 3685 | | |
3686 | 3686 | | |
| 3687 | + | |
3687 | 3688 | | |
3688 | 3689 | | |
3689 | 3690 | | |
3690 | 3691 | | |
3691 | 3692 | | |
| 3693 | + | |
3692 | 3694 | | |
3693 | 3695 | | |
3694 | 3696 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments