decode: introduce DecodeThreadVarsFree

As a mirror of DecodeThreadVarsAlloc, DecodeThreadVarsFree is used
to free the memory that DecodeThreadVarsAlloc alloc'd, including
AppLayer storage.
pull/914/merge
Victor Julien 12 years ago
parent 552558894c
commit d26ceb2356

@ -475,6 +475,15 @@ DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *tv)
return dtv; 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 * \brief Set data for Packet and set length when zeo copy is used
* *

@ -808,6 +808,7 @@ int PacketCopyDataOffset(Packet *p, int offset, uint8_t *data, int datalen);
const char *PktSrcToString(enum PktSrcEnum pkt_src); const char *PktSrcToString(enum PktSrcEnum pkt_src);
DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *); DecodeThreadVars *DecodeThreadVarsAlloc(ThreadVars *);
void DecodeThreadVarsFree(DecodeThreadVars *);
/* decoder functions */ /* decoder functions */
int DecodeEthernet(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *); int DecodeEthernet(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, PacketQueue *);

Loading…
Cancel
Save