From e2f7226569c67ad8aaca83dfe84b4211a42969c1 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 8 Jan 2014 18:43:48 +0100 Subject: [PATCH] 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. --- src/flow-util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); \ } \