Skip to content

Commit 9216b8b

Browse files
committed
phar: Fix memory leak when setAlias() fails
Closes phpGH-20135.
1 parent da39975 commit 9216b8b

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ PHP NEWS
1717

1818
- Phar:
1919
. Fix memory leak of argument in webPhar. (nielsdos)
20+
. Fix memory leak when setAlias() fails. (nielsdos)
2021

2122
- Random:
2223
. Fix Randomizer::__serialize() w.r.t. INDIRECTs. (nielsdos)

ext/phar/phar_object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,6 +2770,7 @@ PHP_METHOD(Phar, setAlias)
27702770
phar_flush(phar_obj->archive, NULL, 0, 0, &error);
27712771

27722772
if (error) {
2773+
pefree(phar_obj->archive->alias, phar_obj->archive->is_persistent);
27732774
phar_obj->archive->alias = oldalias;
27742775
phar_obj->archive->alias_len = oldalias_len;
27752776
phar_obj->archive->is_temporary_alias = old_temp;

0 commit comments

Comments
 (0)