dlaurent42/42sh

[bug] (subshell leaks) leak when executing '/'

Closed this issue · 0 comments

The following is a leak (and a subshell for some reason)

$> /

Valgrind:

==64944==
==64944== HEAP SUMMARY:
==64944==     in use at exit: 35,713 bytes in 197 blocks
==64944==   total heap usage: 32,912 allocs, 32,715 frees, 10,426,244 bytes allocated
==64944==
==64944== 72 bytes in 3 blocks are possibly lost in loss record 46 of 77
==64944==    at 0x1000F50B2: calloc (in /Users/dhojt/.brew/Cellar/valgrind/3.13.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==64944==    by 0x100650832: map_images_nolock (in /usr/lib/libobjc.A.dylib)
==64944==    by 0x100663D6A: map_images (in /usr/lib/libobjc.A.dylib)
==64944==    by 0x10006303B: dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*), bool, bool) (in /usr/lib/dyld)
==64944==    by 0x100063255: dyld::registerObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*)) (in /usr/lib/dyld)
==64944==    by 0x10029E00A: _dyld_objc_notify_register (in /usr/lib/system/libdyld.dylib)
==64944==    by 0x100650072: _objc_init (in /usr/lib/libobjc.A.dylib)
==64944==    by 0x10023168D: _os_object_init (in /usr/lib/system/libdispatch.dylib)
==64944==    by 0x10023163A: libdispatch_init (in /usr/lib/system/libdispatch.dylib)
==64944==    by 0x1001459D5: libSystem_initializer (in /usr/lib/libSystem.B.dylib)
==64944==    by 0x100073A1A: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==64944==    by 0x100073C1D: ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
==64944==
==64944== 2,064 (16 direct, 2,048 indirect) bytes in 1 blocks are definitely lost in loss record 72 of 77
==64944==    at 0x1000F4A46: malloc (in /Users/dhojt/.brew/Cellar/valgrind/3.13.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==64944==    by 0x100588103: _nc_table_new (in /usr/lib/system/libsystem_notify.dylib)
==64944==    by 0x100583FB5: _notify_init_globals (in /usr/lib/system/libsystem_notify.dylib)
==64944==    by 0x100591AC0: _os_once (in /usr/lib/system/libsystem_platform.dylib)
==64944==    by 0x100591A91: _os_alloc_once (in /usr/lib/system/libsystem_platform.dylib)
==64944==    by 0x1005840AD: _notify_fork_child (in /usr/lib/system/libsystem_notify.dylib)
==64944==    by 0x100145B20: libSystem_atfork_child (in /usr/lib/libSystem.B.dylib)
==64944==    by 0x10030E436: fork (in /usr/lib/system/libsystem_c.dylib)
==64944==    by 0x10000DD78: sh_command_exec (run.c:49)
==64944==    by 0x10000DD1D: sh_command_dispatch (run.c:74)
==64944==    by 0x100015EB4: sh_command_found (parser.c:57)
==64944==    by 0x100015BF4: sh_command_run_ast (parser.c:105)
==64944==
==64944== 2,064 (16 direct, 2,048 indirect) bytes in 1 blocks are definitely lost in loss record 73 of 77
==64944==    at 0x1000F4A46: malloc (in /Users/dhojt/.brew/Cellar/valgrind/3.13.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==64944==    by 0x100588103: _nc_table_new (in /usr/lib/system/libsystem_notify.dylib)
==64944==    by 0x100583FC6: _notify_init_globals (in /usr/lib/system/libsystem_notify.dylib)
==64944==    by 0x100591AC0: _os_once (in /usr/lib/system/libsystem_platform.dylib)
==64944==    by 0x100591A91: _os_alloc_once (in /usr/lib/system/libsystem_platform.dylib)
==64944==    by 0x1005840AD: _notify_fork_child (in /usr/lib/system/libsystem_notify.dylib)
==64944==    by 0x100145B20: libSystem_atfork_child (in /usr/lib/libSystem.B.dylib)
==64944==    by 0x10030E436: fork (in /usr/lib/system/libsystem_c.dylib)
==64944==    by 0x10000DD78: sh_command_exec (run.c:49)
==64944==    by 0x10000DD1D: sh_command_dispatch (run.c:74)
==64944==    by 0x100015EB4: sh_command_found (parser.c:57)
==64944==    by 0x100015BF4: sh_command_run_ast (parser.c:105)
==64944==
==64944== LEAK SUMMARY:
==64944==    definitely lost: 32 bytes in 2 blocks
==64944==    indirectly lost: 4,096 bytes in 2 blocks
==64944==      possibly lost: 72 bytes in 3 blocks
==64944==    still reachable: 7,342 bytes in 27 blocks
==64944==         suppressed: 24,171 bytes in 163 blocks
==64944== Reachable blocks (those to which a pointer was found) are not shown.
==64944== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==64944==
==64944== For counts of detected and suppressed errors, rerun with: -v
==64944== Use --track-origins=yes to see where uninitialised values come from
==64944== ERROR SUMMARY: 5 errors from 4 contexts (suppressed: 14 from 14)