Bug #72982 [NEW]: Memory leak in zend_accel_blacklist_update_regexp() function
| From: | irishbughunting at gmail dot com | Date: | Wed, 31 Aug 2016 00:24:54 +0000 |
| Subject: | Bug #72982 [NEW]: Memory leak in zend_accel_blacklist_update_regexp() function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-203692@lists.php.net to get a copy of this message | ||
From: irishbughunting at gmail dot com
Operating system: Any
PHP version: 7.0.10
Package: Regexps related
Bug Type: Bug
Bug description:Memory leak in zend_accel_blacklist_update_regexp() function
Description:
------------
Description
===========
Due to the zend_accel_blacklist_update_regexp() function not
releasing/freeing memory allocated on the heap, a memory leak can occur.
This relates to the *it pointer.
Code Snippet
============
static void zend_accel_blacklist_update_regexp(zend_blacklist
*blacklist)
{
const char *pcre_error;
int i, pcre_error_offset;
zend_regexp_list **regexp_list_it, *it;
char regexp[12*1024], *p, *end, *c, *backtrack = NULL;
----------SNIP---------
it = (zend_regexp_list*)malloc(sizeof(zend_regexp_list));
if (!it) {
zend_accel_error(ACCEL_LOG_ERROR, "malloc() failed\n");
return;
}
it->next = NULL;
if ((it->re = pcre_compile(regexp, PCRE_NO_AUTO_CAPTURE, &pcre_error,
&pcre_error_offset, 0)) == NULL) {
blacklist_report_regexp_error(pcre_error, pcre_error_offset);
}
/* prepare for the next iteration */
p = regexp + 2;
*regexp_list_it = it;
regexp_list_it = &it->next;
----------SNIP---------
Expected result:
----------------
An expected result it that the *it pointer is free'd after finish of
use, as opposed to using up unnecessary system resources.
Actual result:
--------------
A memory leak occurs.
--
Edit bug report at https://bugs.php.net/bug.php?id=72982&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72982&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72982&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72982&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72982&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72982&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72982&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72982&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72982&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72982&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72982&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72982&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72982&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72982&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72982&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72982&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72982&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72982&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72982&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72982&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72982&r=mysqlcfg