Created
September 2, 2014 22:34
-
-
Save jwerle/aa2d9725a93f724c72f4 to your computer and use it in GitHub Desktop.
leaks in setenv - OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
werle:~/tmp | |
× cc setenvbug.c -o setenvbug | |
werle:~/tmp | |
√ valgrind --leak-check=yes --track-origins=yes --dsymutil=yes setenvbug | |
==37306== Memcheck, a memory error detector | |
==37306== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. | |
==37306== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info | |
==37306== Command: setenvbug | |
==37306== | |
==37306== WARNING: Support on MacOS 10.8/10.9 is experimental and mostly broken. | |
==37306== WARNING: Expect incorrect results, assertions and crashes. | |
==37306== WARNING: In particular, Memcheck on 32-bit programs will fail to | |
==37306== WARNING: detect any errors associated with heap-allocated data. | |
==37306== | |
==37306== | |
==37306== HEAP SUMMARY: | |
==37306== in use at exit: 25,849 bytes in 379 blocks | |
==37306== total heap usage: 457 allocs, 78 frees, 31,865 bytes allocated | |
==37306== | |
==37306== 80 (16 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 47 of 79 | |
==37306== at 0x6DFB: malloc (in /usr/local/Cellar/valgrind/3.9.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) | |
==37306== by 0x1A4424: _owned_ptr_alloc (in /usr/lib/system/libsystem_c.dylib) | |
==37306== by 0x1A4A9A: setenv (in /usr/lib/system/libsystem_c.dylib) | |
==37306== by 0x100000F3F: indirect (in ./setenvbug) | |
==37306== by 0x100000F63: main (in ./setenvbug) | |
==37306== | |
==37306== LEAK SUMMARY: | |
==37306== definitely lost: 16 bytes in 1 blocks | |
==37306== indirectly lost: 64 bytes in 1 blocks | |
==37306== possibly lost: 0 bytes in 0 blocks | |
==37306== still reachable: 312 bytes in 2 blocks | |
==37306== suppressed: 25,457 bytes in 375 blocks | |
==37306== Reachable blocks (those to which a pointer was found) are not shown. | |
==37306== To see them, rerun with: --leak-check=full --show-leak-kinds=all | |
==37306== | |
==37306== For counts of detected and suppressed errors, rerun with: -v | |
==37306== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 148 from 49) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
void | |
indirect (void) { | |
setenv("FOO", "BAR", 1); | |
} | |
int | |
main (void) { | |
indirect(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment