Bug #77785 [NEW]: memory leak… in "do_register_internal_class"

From: Date: Sat, 23 Mar 2019 11:13:11 +0000
Subject: Bug #77785 [NEW]: memory leak… in "do_register_internal_class"
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220149@lists.php.net to get a copy of this message
From:             aotto1968 at t-online dot de
Operating system: linux latest
PHP version:      7.3.3
Package:          *General Issues
Bug Type:         Bug
Bug description:memory leak… in "do_register_internal_class"

Description:
------------
Problem… overwrite "lowercase_name" without free ressource.


==44094== 32 bytes in 1 blocks are possibly lost in loss record 1,002 of
2,699
==44094==    at 0x4C2A080: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==44094==    by 0x6A7681: __zend_malloc (zend_alloc.c:2903)
==44094==    by 0x6D1834: zend_string_alloc (zend_string.h:133)
==44094==    by 0x6DCEE3: zend_string_tolower_ex
(zend_operators.c:2677)
==44094==    by 0x6EEAF7: do_register_internal_class (zend_API.c:2730)
==44094==    by 0x6EECBF: zend_register_internal_class
(zend_API.c:2775)
==44094==    by 0x6EEB7E: zend_register_internal_class_ex
(zend_API.c:2747)
==44094==    by 0x683E9B2: phpmsgque_MqDumpC_Init (MqDumpC_php.c:422)
==44094==    by 0x6815718: zm_startup_phpmsgque (phpmsgque.c:104)
==44094==    by 0x6EBC6A: zend_startup_module_ex (zend_API.c:1878)
==44094==    by 0x6EBCE8: zend_startup_module_zval (zend_API.c:1893)
==44094==    by 0x6FB15A: zend_hash_apply (zend_hash.c:1688)
==44094==    by 0x6EC32C: zend_startup_modules (zend_API.c:2004)
==44094==    by 0x633DE1: php_module_startup (main.c:2333)
==44094==    by 0x7C1017: php_cli_startup (php_cli.c:420)
==44094==    by 0x7C301C: main (php_cli.c:1356)


static zend_class_entry *do_register_internal_class(zend_class_entry
*orig_class_entry, uint32_t ce_flags) /* {{{ */
{   
    zend_class_entry *class_entry = malloc(sizeof(zend_class_entry));
    zend_string *lowercase_name;
    *class_entry = *orig_class_entry;

    class_entry->type = ZEND_INTERNAL_CLASS;
    zend_initialize_class_data(class_entry, 0);
    class_entry->ce_flags = ce_flags | ZEND_ACC_CONSTANTS_UPDATED;
    class_entry->info.internal.module = EG(current_module);

    if (class_entry->info.internal.builtin_functions) {
        zend_register_functions(class_entry,
class_entry->info.internal.builtin_functions,
&class_entry->function_table, MODULE_PERSISTENT);
    }

>>>>>    lowercase_name = zend_string_tolower_ex(orig_class_entry->name,
1);
>>>>>    lowercase_name = zend_new_interned_string(lowercase_name);
    zend_hash_update_ptr(CG(class_table), lowercase_name, class_entry);
    zend_string_release_ex(lowercase_name, 1);
    return class_entry;
}




-- 
Edit bug report at https://bugs.php.net/bug.php?id=77785&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=77785&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=77785&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=77785&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=77785&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=77785&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=77785&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=77785&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=77785&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=77785&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=77785&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=77785&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=77785&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=77785&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77785&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=77785&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=77785&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=77785&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77785&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=77785&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=77785&r=mysqlcfg



Thread (3 messages)

« previous php.bugs (#220149) next »