From: Victor Julien Date: Wed, 8 Jan 2014 17:43:48 +0000 (+0100) Subject: App Layer: fix memory leaks X-Git-Tag: suricata-2.0rc1~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2f7226569c67ad8aaca83dfe84b4211a42969c1;p=thirdparty%2Fsuricata.git App Layer: fix memory leaks Call FlowCleanupAppLayer before setting f->proto to 0, as the former bails out without doing anything if proto is 0. --- diff --git a/src/flow-util.h b/src/flow-util.h index d3c162fb03..3ed8c2f6d5 100644 --- a/src/flow-util.h +++ b/src/flow-util.h @@ -78,6 +78,7 @@ * managed by the queueing code. Same goes for fb (FlowBucket ptr) field. */ #define FLOW_RECYCLE(f) do { \ + FlowCleanupAppLayer((f)); \ (f)->sp = 0; \ (f)->dp = 0; \ (f)->proto = 0; \ @@ -87,7 +88,6 @@ (f)->flags = 0; \ (f)->lastts_sec = 0; \ (f)->protoctx = NULL; \ - FlowCleanupAppLayer((f)); \ (f)->alparser = NULL; \ (f)->alstate = NULL; \ (f)->alproto = 0; \ @@ -110,10 +110,10 @@ } while(0) #define FLOW_DESTROY(f) do { \ + FlowCleanupAppLayer((f)); \ SC_ATOMIC_DESTROY((f)->use_cnt); \ \ FLOWLOCK_DESTROY((f)); \ - FlowCleanupAppLayer((f)); \ if ((f)->de_state != NULL) { \ DetectEngineStateFree((f)->de_state); \ } \