From: Victor Julien Date: Wed, 5 Mar 2014 11:18:57 +0000 (+0100) Subject: decode: introduce DecodeThreadVarsFree X-Git-Tag: suricata-2.0.1rc1~82 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d26ceb23562ee77777f64390900c27f1e50198be;p=thirdparty%2Fsuricata.git decode: introduce DecodeThreadVarsFree As a mirror of DecodeThreadVarsAlloc, DecodeThreadVarsFree is used to free the memory that DecodeThreadVarsAlloc alloc'd, including AppLayer storage. --- diff --git a/src/decode.c b/src/decode.c index c7c0b4ccd9..1aa964c5f1 100644 --- a/src/decode.c +++ b/src/decode.c @@ -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 * diff --git a/src/decode.h b/src/decode.h index 80458cb6d3..c373711228 100644 --- a/src/decode.h +++ b/src/decode.h @@ -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 *);