[php-src] PHP-8.4: Fix error buffer cleanup in phar_open_parsed_phar() (#25376)
| From: | Akira via Weilin Du | Date: | Wed, 11 Nov 2026 11:59:30 +0000 |
| Subject: | [php-src] PHP-8.4: Fix error buffer cleanup in phar_open_parsed_phar() (#25376) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143578@lists.php.net to get a copy of this message | ||
Author: Akira (matyapiro31)
Committer: Weilin Du (LamentXU123)
Date: 2026-11-11T19:55:47+08:00
Commit: https://github.com/php/php-src/commit/d7311be3453b498d3b13ba1f369fe169d7818cf2
Raw diff: https://github.com/php/php-src/commit/d7311be3453b498d3b13ba1f369fe169d7818cf2.diff
Fix error buffer cleanup in phar_open_parsed_phar() (#25376)
The error output parameter is a char **. Free the allocated message through
*error and reset it to NULL after freeing it.
Closes #25376
Changed paths:
M ext/phar/phar.c
Diff:
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index fc21692db2c1..d15ca0b4e85e 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -558,7 +558,8 @@ static zend_result phar_open_parsed_phar(char *fname, size_t fname_len, char *al
}
if (phar && error && !(options & REPORT_ERRORS)) {
- efree(error);
+ efree(*error);
+ *error = NULL;
}
return FAILURE;