From: Victor Julien Date: Thu, 27 Feb 2014 09:55:01 +0000 (+0100) Subject: profiling: fix memory leak X-Git-Tag: suricata-2.0rc2~52 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9eed83c62b5446abcddd596d47d45f26230e77d2;p=thirdparty%2Fsuricata.git profiling: fix memory leak For packets that were freed, not recycled, profiling memory wasn't freed: ==15745== 13,312 bytes in 8 blocks are definitely lost in loss record 611 of 615 ==15745== at 0x4C2C494: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==15745== by 0xA190D5: SCProfilePacketStart (util-profiling.c:963) ==15745== by 0x4E4345: PacketGetFromAlloc (decode.c:134) ==15745== by 0x83FE75: FlowForceReassemblyPseudoPacketGet (flow-timeout.c:276) ==15745== by 0x8413BF: FlowForceReassemblyForHash (flow-timeout.c:588) ==15745== by 0x841897: FlowForceReassembly (flow-timeout.c:716) ==15745== by 0x9540F6: main (suricata.c:2296) ==15745== ==15745== 14,976 bytes in 9 blocks are definitely lost in loss record 612 of 615 ==15745== at 0x4C2C494: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==15745== by 0xA190D5: SCProfilePacketStart (util-profiling.c:963) ==15745== by 0x4E4345: PacketGetFromAlloc (decode.c:134) ==15745== by 0x83FE75: FlowForceReassemblyPseudoPacketGet (flow-timeout.c:276) ==15745== by 0x841508: FlowForceReassemblyForHash (flow-timeout.c:620) ==15745== by 0x841897: FlowForceReassembly (flow-timeout.c:716) ==15745== by 0x9540F6: main (suricata.c:2296) This patch addresses that. --- diff --git a/src/decode.h b/src/decode.h index ea813fecf9..80458cb6d3 100644 --- a/src/decode.h +++ b/src/decode.h @@ -719,6 +719,7 @@ typedef struct DecodeThreadVars_ } \ SCMutexDestroy(&(p)->tunnel_mutex); \ AppLayerDecoderEventsFreeEvents(&(p)->app_layer_events); \ + PACKET_PROFILING_RESET((p)); \ } while (0)