little bug on hdf_remove_tree()
2013-04-03 08:31:18 GMT
int main(int argc, char **argv, char **envp){HDF *node, *cnode;hdf_init(&node);hdf_set_value(node, "foo.0.pic", "xxx.jpg");hdf_set_value(node, "bar.0.pic", "yyy.jpg");cnode = hdf_get_child(node, "foo");hdf_copy(node, "gifts.0", cnode);cnode = hdf_get_child(node, "bar");hdf_copy(node, "gifts.1", cnode);hdf_remove_tree(node, "bar");hdf_set_value(node, "zzzz", "4");hdf_destroy(&node);return 0;}
[root <at> mdev demo]# valgrind --leak-check=full ./hdfremove==16521== Memcheck, a memory error detector.==16521== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.==16521== Using LibVEX rev 1658, a library for dynamic binary translation.==16521== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.==16521== Using valgrind-3.2.1, a dynamic binary instrumentation framework.==16521== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.==16521== For more details, rerun with: -v==16521====16521== Invalid read of size 8==16521== at 0x41D653: _set_value (neo_hdf.c:675)==16521== by 0x41E397: hdf_set_value (neo_hdf.c:829)==16521== by 0x406382: main (hdfremove.c:22)==16521== Address 0x6FE5558 is 48 bytes inside a block of size 112 free'd==16521== at 0x4A0541E: free (vg_replace_malloc.c:233)==16521== by 0x41CF43: _dealloc_hdf (neo_hdf.c:164)==16521== by 0x41D0AA: hdf_remove_tree (neo_hdf.c:1018)iv>==16521== by 0x40636F: main (hdfremove.c:20)==16521====16521== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 1)==16521== malloc/free: in use at exit: 184 bytes in 2 blocks.==16521== malloc/free: 33 allocs, 31 frees, 1,797 bytes allocated.==16521== For counts of detected errors, rerun with: -v==16521== searching for pointers to 2 not-freed blocks.==16521== checked 792,216 bytes.==16521====16521== LEAK SUMMARY:==16521== definitely lost: 0 bytes in 0 blocks.==16521== possibly lost: 0 bytes in 0 blocks.==16521== still reachable: 184 bytes in 2 blocks.==16521== suppressed: 0 bytes in 0 blocks.==16521== Reachable blocks (those to which a pointer was found) are not shown.==16521== To see them, rerun with: --show-reachable=yes[root <at> mdev demo]#
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (1) |
RSS Feed