Memory leak in `ex_jsonparse` #28

Closed
PerGraa opened this Issue Nov 3, 2016 · 1 comment

Projects

None yet

2 participants

@PerGraa
Contributor
PerGraa commented Nov 3, 2016

I have a fix and will make a pull request soon.

graa@luvm:~/json/jvar/bin$ valgrind --leak-check=full --show-reachable=no --num-callers=40 --track-origins=yes ./ex_jsonparse 
==31287== Memcheck, a memory error detector
==31287== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==31287== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==31287== Command: ./ex_jsonparse
==31287== 

<skip output from ex_jsonparse>

==31287== 
==31287== HEAP SUMMARY:
==31287==     in use at exit: 105,520 bytes in 2 blocks
==31287==   total heap usage: 778 allocs, 776 frees, 334,573 bytes allocated
==31287== 
==31287== 32,816 bytes in 1 blocks are definitely lost in loss record 1 of 2
==31287==    at 0x4C2DBB6: malloc (vg_replace_malloc.c:299)
==31287==    by 0x5498609: __alloc_dir (opendir.c:247)
==31287==    by 0x5498609: opendir_tail (opendir.c:145)
==31287==    by 0x5498609: opendir (opendir.c:200)
==31287==    by 0x4056D9: testJsonSuite() (in /home/graa/json/jvar/bin/ex_jsonparse)
==31287==    by 0x405374: main (in /home/graa/json/jvar/bin/ex_jsonparse)
==31287== 
==31287== LEAK SUMMARY:
==31287==    definitely lost: 32,816 bytes in 1 blocks
==31287==    indirectly lost: 0 bytes in 0 blocks
==31287==      possibly lost: 0 bytes in 0 blocks
==31287==    still reachable: 72,704 bytes in 1 blocks
==31287==         suppressed: 0 bytes in 0 blocks
==31287== Reachable blocks (those to which a pointer was found) are not shown.
==31287== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==31287== 
==31287== For counts of detected and suppressed errors, rerun with: -v
==31287== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
@PerGraa PerGraa added a commit to PerGraa/jvar that referenced this issue Nov 3, 2016
@PerGraa PerGraa Fix issue #28 617c790
@YasserAsmi
Owner

Merged PerGraa's fix

@YasserAsmi YasserAsmi closed this Nov 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment