]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: clean up decode thread local storage
authorVictor Julien <victor@inliniac.net>
Fri, 28 Mar 2014 11:01:12 +0000 (12:01 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 2 Apr 2014 11:13:51 +0000 (13:13 +0200)
Clean up the thread local data of the decode part of afpacket.

Bug #978

src/source-af-packet.c

index 0049c852c92304168e4a4d2ad2d3dc14c769bda8..a83e21eb388c4013f2a77f37ceabcb03bd0a6e85 100644 (file)
@@ -246,6 +246,7 @@ TmEcode ReceiveAFPThreadDeinit(ThreadVars *, void *);
 TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot);
 
 TmEcode DecodeAFPThreadInit(ThreadVars *, void *, void **);
+TmEcode DecodeAFPThreadDeinit(ThreadVars *tv, void *data);
 TmEcode DecodeAFP(ThreadVars *, Packet *, void *, PacketQueue *, PacketQueue *);
 
 TmEcode AFPSetBPFFilter(AFPThreadVars *ptv);
@@ -483,7 +484,7 @@ void TmModuleDecodeAFPRegister (void) {
     tmm_modules[TMM_DECODEAFP].ThreadInit = DecodeAFPThreadInit;
     tmm_modules[TMM_DECODEAFP].Func = DecodeAFP;
     tmm_modules[TMM_DECODEAFP].ThreadExitPrintStats = NULL;
-    tmm_modules[TMM_DECODEAFP].ThreadDeinit = NULL;
+    tmm_modules[TMM_DECODEAFP].ThreadDeinit = DecodeAFPThreadDeinit;
     tmm_modules[TMM_DECODEAFP].RegisterTests = NULL;
     tmm_modules[TMM_DECODEAFP].cap_flags = 0;
     tmm_modules[TMM_DECODEAFP].flags = TM_FLAG_DECODE_TM;
@@ -1894,6 +1895,13 @@ TmEcode DecodeAFPThreadInit(ThreadVars *tv, void *initdata, void **data)
     SCReturnInt(TM_ECODE_OK);
 }
 
+TmEcode DecodeAFPThreadDeinit(ThreadVars *tv, void *data)
+{
+    if (data != NULL)
+        DecodeThreadVarsFree(data);
+    SCReturnInt(TM_ECODE_OK);
+}
+
 #endif /* HAVE_AF_PACKET */
 /* eof */
 /**