]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
App Layer: fix memory leaks
authorVictor Julien <victor@inliniac.net>
Wed, 8 Jan 2014 17:43:48 +0000 (18:43 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 10 Jan 2014 10:53:41 +0000 (11:53 +0100)
Call FlowCleanupAppLayer before setting f->proto to 0, as the former
bails out without doing anything if proto is 0.

src/flow-util.h

index d3c162fb03c7ea4a919f04e4a01ba81e641f645d..3ed8c2f6d5cede1cc7a417ff9ef77c331351e2ed 100644 (file)
@@ -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; \
     } 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); \
         } \