mirror of https://github.com/OISF/suricata
util-radix-tree: fix memleak
Logic used when adding a new prefix to a node was not correct as we were allocating a prefix that could be at the end unused. This patch is updating the code to have a complete creation to be done if and only if we are needing the complete object. In the other cases, it was enough to use the function input values. This fixes: 104 (48 direct, 56 indirect) bytes in 2 blocks are definitely lost in loss record 184 of 327 at 0x4C29C0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x9C2DAD: SCRadixCreatePrefix (util-radix-tree.c:144) by 0x9AFA5B: SCRadixAddKey (util-radix-tree.c:522) by 0x9B1A4D: SCRadixAddKeyIPV4Netblock (util-radix-tree.c:897) by 0x67C824: IPOnlyPrepare (detect-engine-iponly.c:1197) by 0x55172B: SigAddressPrepareStage2 (detect.c:3534) by 0x5486F4: SigGroupBuild (detect.c:4671) by 0x547C87: SigLoadSignatures (detect.c:538) by 0x8FB5D0: LoadSignatures (suricata.c:1976) by 0x8F3B32: main (suricata.c:2342)pull/1910/head
parent
9c7e18dc89
commit
f001c10ac4
Loading…
Reference in New Issue