Bug #67856 [NEW]: Leak when using array_reduce with by-ref function

From: Date: Mon, 18 Aug 2014 14:59:25 +0000
Subject: Bug #67856 [NEW]: Leak when using array_reduce with by-ref function
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187165@lists.php.net to get a copy of this message
From: nikic Operating system: PHP version: master-Git-2014-08-18 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Leak when using array_reduce with by-ref function Description: ------------ Valgrind output: ~/dev/php-src$ ./leak-check.sh t72.php ==31421== Memcheck, a memory error detector ==31421== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==31421== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==31421== Command: sapi/cli/php t72.php ==31421== int(6) ==31421== ==31421== HEAP SUMMARY: ==31421== in use at exit: 180 bytes in 7 blocks ==31421== total heap usage: 14,479 allocs, 14,472 frees, 1,478,806 bytes allocated ==31421== ==31421== 144 bytes in 6 blocks are definitely lost in loss record 2 of 2 ==31421== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==31421== by 0x8440E25: _emalloc (zend_alloc.c:2438) ==31421== by 0x8468C0B: zend_call_function (zend_execute_API.c:815) ==31421== by 0x8333833: zif_array_reduce (array.c:4305) ==31421== by 0x84C39BC: ZEND_DO_FCALL_SPEC_HANDLER (zend_vm_execute.h:595) ==31421== by 0x84C2D16: execute_ex (zend_vm_execute.h:354) ==31421== by 0x84C2ECA: zend_execute (zend_vm_execute.h:383) ==31421== by 0x847FC4F: zend_execute_scripts (zend.c:1319) ==31421== by 0x83D9C4C: php_execute_script (main.c:2564) ==31421== by 0x852CE63: do_cli (php_cli.c:980) ==31421== by 0x852E217: main (php_cli.c:1358) ==31421== ==31421== LEAK SUMMARY: ==31421== definitely lost: 144 bytes in 6 blocks ==31421== indirectly lost: 0 bytes in 0 blocks ==31421== possibly lost: 0 bytes in 0 blocks ==31421== still reachable: 36 bytes in 1 blocks ==31421== suppressed: 0 bytes in 0 blocks ==31421== Reachable blocks (those to which a pointer was found) are not shown. ==31421== To see them, rerun with: --leak-check=full --show-reachable=yes ==31421== ==31421== For counts of detected and suppressed errors, rerun with: -v ==31421== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) Test script: --------------- <?php $array = [1, 2, 3]; var_dump(array_reduce($array, function(&$a, &$b) { return $a + $b; }, 0)); -- Edit bug report at https://bugs.php.net/bug.php?id=67856&edit=1 --

« previous php.bugs (#187165) next »