]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
decode: introduce DecodeThreadVarsFree
authorVictor Julien <victor@inliniac.net>
Wed, 5 Mar 2014 11:18:57 +0000 (12:18 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 2 Apr 2014 11:13:51 +0000 (13:13 +0200)
As a mirror of DecodeThreadVarsAlloc, DecodeThreadVarsFree is used
to free the memory that DecodeThreadVarsAlloc alloc'd, including
AppLayer storage.

src/decode.c
src/decode.h

index c7c0b4ccd944383cc200a5a41009943f0152b5c9..1aa964c5f1be7b82ee6a7f1760fc2f31ffaf85da 100644 (file)
@@ -475,6 +475,15 @@ DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *tv)
     return dtv;
 }
 
+void DecodeThreadVarsFree(DecodeThreadVars *dtv)
+{
+    if (dtv != NULL) {
+        if (dtv->app_tctx != NULL)
+            AppLayerDestroyCtxThread(dtv->app_tctx);
+        SCFree(dtv);
+    }
+}
+
 /**
  * \brief Set data for Packet and set length when zeo copy is used
  *
index 80458cb6d3198c396bdf1a023881deeea9e98b02..c3737112286b851e9a337adf8fe3b11b2166a7ad 100644 (file)
@@ -808,6 +808,7 @@ int PacketCopyDataOffset(Packet *p, int offset, uint8_t *data, int datalen);
 const char *PktSrcToString(enum PktSrcEnum pkt_src);
 
 DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *);
+void DecodeThreadVarsFree(DecodeThreadVars *);
 
 /* decoder functions */
 int DecodeEthernet(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);