[php-src] master: Fix string freeing in phar_follow_one_link()

Ilija Tovilo <[email protected]> Tue, 28 Jul 2026 10:05:07 +0000
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Ilija Tovilo (iluuu1994)
Date: 2026-07-28T12:04:27+02:00

Commit: https://github.com/php/php-src/commit/56b8d1040d83a4731e7b286b890cffef559de87b
Raw diff: https://github.com/php/php-src/commit/56b8d1040d83a4731e7b286b890cffef559de87b.diff

Fix string freeing in phar_follow_one_link()

Faulty merge on my part.

Changed paths:
  M  ext/phar/util.c


Diff:

diff --git a/ext/phar/util.c b/ext/phar/util.c
index 37373c26bfac..b93bf6940dea 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -71,15 +71,11 @@ static phar_entry_info *phar_follow_one_link(phar_entry_info *entry)
 	link = phar_get_link_location(entry);
 	if (NULL != (link_entry = zend_hash_find_ptr(&(entry->phar->manifest), entry->symlink)) ||
 		NULL != (link_entry = zend_hash_find_ptr(&(entry->phar->manifest), link))) {
-		if (link != entry->symlink) {
-			efree(link);
-		}
+		zend_string_release(link);
 		return link_entry;
 	}
 
-	if (link != entry->symlink) {
-		efree(link);
-	}
+	zend_string_release(link);
 	return NULL;
 }