Skip to content

Commit 0dd2da1

Browse files
committed
phar: Avoid memory allocation in setAlias() error code
1 parent 29d6e29 commit 0dd2da1

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ext/phar/phar_object.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,13 +2730,10 @@ PHP_METHOD(Phar, setAlias)
27302730
RETURN_TRUE;
27312731
}
27322732
if (NULL != (fd_ptr = zend_hash_find_ptr(&(PHAR_G(phar_alias_map)), new_alias))) {
2733-
spprintf(&error, 0, "alias \"%s\" is already used for archive \"%s\" and cannot be used for other archives", ZSTR_VAL(new_alias), fd_ptr->fname);
27342733
if (SUCCESS == phar_free_alias(fd_ptr, ZSTR_VAL(new_alias), ZSTR_LEN(new_alias))) {
2735-
efree(error);
27362734
goto valid_alias;
27372735
}
2738-
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
2739-
efree(error);
2736+
zend_throw_exception_ex(phar_ce_PharException, 0, "alias \"%s\" is already used for archive \"%s\" and cannot be used for other archives", ZSTR_VAL(new_alias), fd_ptr->fname);
27402737
RETURN_THROWS();
27412738
}
27422739
if (!phar_validate_alias(ZSTR_VAL(new_alias), ZSTR_LEN(new_alias))) {

0 commit comments

Comments
 (0)