[Bug 14521] setenv overrite & unsetenv lead memory leak

bugzilla at busybox.net bugzilla at busybox.net
Fri Feb 23 01:15:28 UTC 2024


https://bugs.busybox.net/show_bug.cgi?id=14521

hanjunnung <715299345 at qq.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |715299345 at qq.com
           Priority|P5                          |P1
           Severity|normal                      |critical

--- Comment #1 from hanjunnung <715299345 at qq.com> ---
The use of valgrind and POC programs proved that SETENV and UNSETENV had a
memory leak problem.

int main(int argc, char **argv)
{
    setenv("test_setenv", "test_setenv", 1);
    setenv("test_setenv", "test_setenv2", 1);
    setenv("test_setenv", "test_setenv22222", 1);
    putenv("test_setenv");
    return 0;    
}

==18333== HEAP SUMMARY:
==18333==     in use at exit: 147 bytes in 5 blocks
==18333==   total heap usage: 6 allocs, 1 frees, 191 bytes allocated
==18333==
==18333== 78 bytes in 3 blocks are definitely lost in loss record 3 of 3
==18333==    at 0x482DAA4: malloc (vg_replace_malloc.c:381)
==18333==    by 0x48D3020: __add_to_environ (in /lib/libuClibc-0.9.33.so)
==18333==
==18333== LEAK SUMMARY:
==18333==    definitely lost: 78 bytes in 3 blocks
==18333==    indirectly lost: 0 bytes in 0 blocks
==18333==      possibly lost: 0 bytes in 0 blocks
==18333==    still reachable: 69 bytes in 2 blocks
==18333==         suppressed: 0 bytes in 0 blocks

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the uClibc-cvs mailing list