Bug #77785 [Fbk->NoF]: memory leak⦠in "do_register_internal_class"
| From: | php-bugs at lists dot php dot net | Date: | Sun, 22 Aug 2021 04:22:10 +0000 |
| Subject: | Bug #77785 [Fbk->NoF]: memory leak⦠in "do_register_internal_class" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235999@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77785&edit=1
ID: 77785
Updated by: php-bugs@lists.php.net
Reported by: aotto1968 at t-online dot de
Summary: memory leak⦠in "do_register_internal_class"
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: *General Issues
Operating System: linux latest
PHP Version: 7.3.3
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2021-08-12 11:11:39] nikic@php.net
I can't reproduce this (that is, I don't see any startup leaks with a normal PHP build --
I haven't tested the phpmsgque extension in particular). The code also looks correct to me:
zend_new_interned_string releases the string passed to it.
------------------------------------------------------------------------
[2019-03-23 11:13:11] aotto1968 at t-online dot de
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 this bug report at https://bugs.php.net/bug.php?id=77785&edit=1