There are still some valgrind issues:

= See 9ef34660fa4a28107a2fb4ada6284e3fd5cb4b52 =


    There seems to be still a problem.
    Need to investigate later,
    the kdb tool does not show this behaviour

    Test sizes in backends with trie
    Invalid read of size 8
       at 0x5082187: elektraBackendClose (backend.c:375)
       by 0x50837A2: kdbClose (kdb.c:258)
       by 0x4043A3: test_triesizes (test_splitget.c:468)
       by 0x406B52: main (test_splitget.c:704)
     Address 0x6c17ef8 is 264 bytes inside a block of size 272 free'd
       at 0x4C240FD: free (vg_replace_malloc.c:366)
       by 0x508223F: elektraBackendClose (backend.c:394)
       by 0x508DB14: elektraTrieClose (trie.c:95)
       by 0x508DAFF: elektraTrieClose (trie.c:93)
       by 0x5083796: kdbClose (kdb.c:256)
       by 0x4043A3: test_triesizes (test_splitget.c:468)
       by 0x406B52: main (test_splitget.c:704)

    Invalid write of size 8
       at 0x5082195: elektraBackendClose (backend.c:375)
       by 0x50837A2: kdbClose (kdb.c:258)
       by 0x4043A3: test_triesizes (test_splitget.c:468)
       by 0x406B52: main (test_splitget.c:704)
     Address 0x6c17ef8 is 264 bytes inside a block of size 272 free'd
       at 0x4C240FD: free (vg_replace_malloc.c:366)
       by 0x508223F: elektraBackendClose (backend.c:394)
       by 0x508DB14: elektraTrieClose (trie.c:95)
       by 0x508DAFF: elektraTrieClose (trie.c:93)
       by 0x5083796: kdbClose (kdb.c:256)
       by 0x4043A3: test_triesizes (test_splitget.c:468)
       by 0x406B52: main (test_splitget.c:704)



= Older issue =


markus@markusbyte:~e/build> v src/kdb/kdb-static rm system/filesystems/home/type                                                           Freitag 14:36:56
==4985== Memcheck, a memory error detector.
==4985== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==4985== Using LibVEX rev 1854, a library for dynamic binary translation.
==4985== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==4985== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation framework.
==4985== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==4985== For more details, rerun with: -v
==4985==
root: user/struct k: user/struct/FStab
creating StructChecker FStab with first key: user/struct/FStab
got back [open] 0x63318d8
open    0000000819      di      0000000819
tracer: open(0x63488d0): system/path=tracer.ecf 1
root: user/struct k: user/struct/FStab
creating StructChecker FStab with first key: user/struct/FStab
got back [open] 0x6377060
open    0000000006      di      0000000006
tracer: open(0x6378f10): system/module=1 user/module=1 2
==4985== Invalid read of size 1
==4985==    at 0x4C23C8E: memmove (mc_replace_strmem.c:517)
==4985==    by 0x4589BC: ksLookup (keyset.c:1395)
==4985==    by 0x42E65D: kdb::KeySet::lookup(kdb::Key const&, int) const (keyset:188)
==4985==    by 0x44AFA9: RemoveCommand::execute(int, char**) (rm.cpp:30)
==4985==    by 0x430971: main (main.cpp:22)
==4985==  Address 0x638fd70 is 0 bytes after a block of size 256 alloc'd
==4985==    at 0x4C22741: realloc (vg_replace_malloc.c:429)
==4985==    by 0x452F3D: elektraRealloc (internal.c:216)
==4985==    by 0x459102: ksResize (keyset.c:1824)
==4985==    by 0x457E37: ksAppend (keyset.c:719)
==4985==    by 0x45E23B: elektraSplitMerge (split.c:469)
==4985==    by 0x453C86: kdbGet (kdb.c:457)
==4985==    by 0x42E5D1: kdb::KDB::get(kdb::KeySet&, kdb::Key&) (kdb:88)
==4985==    by 0x44AF93: RemoveCommand::execute(int, char**) (rm.cpp:29)
==4985==    by 0x430971: main (main.cpp:22)
==4985==
==4985== Invalid read of size 1
==4985==    at 0x4C23C80: memmove (mc_replace_strmem.c:517)
==4985==    by 0x4589BC: ksLookup (keyset.c:1395)
==4985==    by 0x42E65D: kdb::KeySet::lookup(kdb::Key const&, int) const (keyset:188)
==4985==    by 0x44AFA9: RemoveCommand::execute(int, char**) (rm.cpp:30)
==4985==    by 0x430971: main (main.cpp:22)
==4985==  Address 0x638fd71 is 1 bytes after a block of size 256 alloc'd
==4985==    at 0x4C22741: realloc (vg_replace_malloc.c:429)
==4985==    by 0x452F3D: elektraRealloc (internal.c:216)
==4985==    by 0x459102: ksResize (keyset.c:1824)
==4985==    by 0x457E37: ksAppend (keyset.c:719)
==4985==    by 0x45E23B: elektraSplitMerge (split.c:469)
==4985==    by 0x453C86: kdbGet (kdb.c:457)
==4985==    by 0x42E5D1: kdb::KDB::get(kdb::KeySet&, kdb::Key&) (kdb:88)
==4985==    by 0x44AF93: RemoveCommand::execute(int, char**) (rm.cpp:29)
==4985==    by 0x430971: main (main.cpp:22)
==4985==
==4985== Invalid write of size 1
==4985==    at 0x4C23C84: memmove (mc_replace_strmem.c:517)
==4985==    by 0x4589BC: ksLookup (keyset.c:1395)
==4985==    by 0x42E65D: kdb::KeySet::lookup(kdb::Key const&, int) const (keyset:188)
==4985==    by 0x44AFA9: RemoveCommand::execute(int, char**) (rm.cpp:30)
==4985==    by 0x430971: main (main.cpp:22)
==4985==  Address 0x638fd70 is 0 bytes after a block of size 256 alloc'd
==4985==    at 0x4C22741: realloc (vg_replace_malloc.c:429)
==4985==    by 0x452F3D: elektraRealloc (internal.c:216)
==4985==    by 0x459102: ksResize (keyset.c:1824)
==4985==    by 0x457E37: ksAppend (keyset.c:719)
==4985==    by 0x45E23B: elektraSplitMerge (split.c:469)
==4985==    by 0x453C86: kdbGet (kdb.c:457)
==4985==    by 0x42E5D1: kdb::KDB::get(kdb::KeySet&, kdb::Key&) (kdb:88)
==4985==    by 0x44AF93: RemoveCommand::execute(int, char**) (rm.cpp:29)
==4985==    by 0x430971: main (main.cpp:22)
got back [set] 0x63318d8
root key is: system/filesystems/home
compare basename: device with cur: device
Apply meta data of user/struct/FStab/device to the key system/filesystems/home/device
compare basename: dumpfreq with cur: dumpfreq
Apply meta data of user/struct/FStab/dumpfreq to the key system/filesystems/home/dumpfreq
compare basename: mpoint with cur: mpoint
Apply meta data of user/struct/FStab/mpoint to the key system/filesystems/home/mpoint
compare basename: options with cur: options
Apply meta data of user/struct/FStab/options to the key system/filesystems/home/options
compare basename: passno with cur: passno
Apply meta data of user/struct/FStab/passno to the key system/filesystems/home/passno
got back [close] 0x6377060
close   0000456684      di      0000456678
tracer: close(0x6378f10)
got back [close] 0x63318d8
close   0000665395      di      0000664576
tracer: close(0x63488d0)
a key was thrown
number: 53
description: Could not check the structure of the keyset
ingroup: plugin
module: struct
at: /home/markus/Projekte/Elektra/current/src/plugins/struct/struct.cpp:156
reason: StructChecker: There should be more elements in the structure
1 Warnings were issued
warnings/#00: number description ingroup module file line function reason
number: 36
description: could not unlink file
ingroup: plugin
module: resolver
at: /home/markus/Projekte/Elektra/current/src/plugins/resolver/resolver.c:326
reason: No such file or directory
==4985==
==4985== ERROR SUMMARY: 42 errors from 3 contexts (suppressed: 8 from 1)
==4985== malloc/free: in use at exit: 0 bytes in 0 blocks.
==4985== malloc/free: 6,241 allocs, 6,241 frees, 371,802 bytes allocated.
==4985== For counts of detected errors, rerun with: -v
==4985== All heap blocks were freed -- no leaks are possible.
