|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77785 memory leak… in "do_register_internal_class"
Submitted: 2019-03-23 11:13 UTC Modified: -
From: aotto1968 at t-online dot de Assigned:
Status: Open Package: *General Issues
PHP Version: 7.3.3 OS: linux latest
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: aotto1968 at t-online dot de
New email:
PHP Version: OS:


 [2019-03-23 11:13 UTC] aotto1968 at t-online dot de
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/
==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;


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 23 23:01:23 2021 UTC