You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We just used you library and checked it in case invalid json through valgrind ( soft for detecting mem leaks and other errors ), we had memory leaks,
my json that i tested:
{
"key" : "value
}
My peace of code:
node = yajl_tree_parse((const char *) data, errbuf, sizeof (errbuf));
if (node == NULL) {
return NULL;
}
Valgrind report:
==14281== Memcheck, a memory error detector
==14281== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==14281== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==14281== Command: ./json_parser_libtest
==14281==
==14281==
==14281== HEAP SUMMARY:
==14281== in use at exit: 414 bytes in 5 blocks
==14281== total heap usage: 13 allocs, 8 frees, 896 bytes allocated
==14281==
==14281== 18 bytes in 1 blocks are definitely lost in loss record 2 of 5
==14281== at 0x402B9FD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14281== by 0x4128524: (below main) (in /lib/libc-2.17.so)
==14281==
==14281== 44 (12 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 5
==14281== at 0x402B9FD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14281== by 0x41098E7: handle_start_map (yajl_tree.c:339)
==14281== by 0x410573D: yajl_do_parse (yajl_parser.c:269)
==14281== by 0x41022E4: yajl_parse (yajl.c:130)
==14281== by 0x4109BB5: yajl_tree_parse (yajl_tree.c:435)
==14281== by 0x40450DE: json_parser (json.c:175)
==14281== by 0x8048A73: main (json_parser_libtest.c:38)
==14281==
==14281== LEAK SUMMARY:
==14281== definitely lost: 30 bytes in 2 blocks
==14281== indirectly lost: 32 bytes in 2 blocks
==14281== possibly lost: 0 bytes in 0 blocks
==14281== still reachable: 352 bytes in 1 blocks
==14281== suppressed: 0 bytes in 0 blocks
==14281== Reachable blocks (those to which a pointer was found) are not shown.
==14281== To see them, rerun with: --leak-check=full --show-reachable=yes
==14281==
==14281== For counts of detected and suppressed errors, rerun with: -v
==14281== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
The text was updated successfully, but these errors were encountered:
- use wrapped malloc() et al wrappers consistently
- update example/parse_config.c to do memory leak detection
- add a regression test using example/parse_config
Several issues in lloyd/yajl complained about this leak, and comments in
lloyd/yajl#102 showed a mostly correct fix though none of these issues
mentioned or actually fixed the directly related error reporting
problem.
Fixeslloyd/yajl#102, fixeslloyd/yajl#113, fixeslloyd/yajl#168, fixeslloyd/yajl#191, fixeslloyd/yajl#223, fixeslloyd/yajl#250. Also fixes
lloy/yajl#185.
We just used you library and checked it in case invalid json through valgrind ( soft for detecting mem leaks and other errors ), we had memory leaks,
my json that i tested:
{
"key" : "value
}
My peace of code:
node = yajl_tree_parse((const char *) data, errbuf, sizeof (errbuf));
if (node == NULL) {
return NULL;
}
Valgrind report:
==14281== Memcheck, a memory error detector
==14281== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==14281== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==14281== Command: ./json_parser_libtest
==14281==
==14281==
==14281== HEAP SUMMARY:
==14281== in use at exit: 414 bytes in 5 blocks
==14281== total heap usage: 13 allocs, 8 frees, 896 bytes allocated
==14281==
==14281== 18 bytes in 1 blocks are definitely lost in loss record 2 of 5
==14281== at 0x402B9FD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14281== by 0x4128524: (below main) (in /lib/libc-2.17.so)
==14281==
==14281== 44 (12 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 5
==14281== at 0x402B9FD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==14281== by 0x41098E7: handle_start_map (yajl_tree.c:339)
==14281== by 0x410573D: yajl_do_parse (yajl_parser.c:269)
==14281== by 0x41022E4: yajl_parse (yajl.c:130)
==14281== by 0x4109BB5: yajl_tree_parse (yajl_tree.c:435)
==14281== by 0x40450DE: json_parser (json.c:175)
==14281== by 0x8048A73: main (json_parser_libtest.c:38)
==14281==
==14281== LEAK SUMMARY:
==14281== definitely lost: 30 bytes in 2 blocks
==14281== indirectly lost: 32 bytes in 2 blocks
==14281== possibly lost: 0 bytes in 0 blocks
==14281== still reachable: 352 bytes in 1 blocks
==14281== suppressed: 0 bytes in 0 blocks
==14281== Reachable blocks (those to which a pointer was found) are not shown.
==14281== To see them, rerun with: --leak-check=full --show-reachable=yes
==14281==
==14281== For counts of detected and suppressed errors, rerun with: -v
==14281== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
The text was updated successfully, but these errors were encountered: