From: Victor Julien Date: Fri, 23 Oct 2020 05:44:28 +0000 (+0200) Subject: dcerpc/tcp: add missing detect state cleanup X-Git-Tag: suricata-6.0.1~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67b5295bbc54abf16609fff355cf289c431ab1be;p=thirdparty%2Fsuricata.git dcerpc/tcp: add missing detect state cleanup --- diff --git a/rust/src/dcerpc/dcerpc.rs b/rust/src/dcerpc/dcerpc.rs index e4fa10e5e7..a14a5de2ac 100644 --- a/rust/src/dcerpc/dcerpc.rs +++ b/rust/src/dcerpc/dcerpc.rs @@ -17,7 +17,7 @@ use std::mem::transmute; use crate::applayer::{AppLayerResult, AppLayerTxData}; -use crate::core; +use crate::core::{self, sc_detect_engine_state_free}; use crate::dcerpc::parser; use nom::error::ErrorKind; use nom::number::Endianness; @@ -184,6 +184,15 @@ impl DCERPCTransaction { }; } + pub fn free(&mut self) { + match self.de_state { + Some(state) => { + sc_detect_engine_state_free(state); + } + _ => {} + } + } + pub fn get_req_ctxid(&self) -> u16 { self.ctxid } @@ -201,6 +210,12 @@ impl DCERPCTransaction { } } +impl Drop for DCERPCTransaction { + fn drop(&mut self) { + self.free(); + } +} + #[derive(Debug)] pub struct DCERPCRequest { pub ctxid: u16,