rust/dhcp: free events and destate at tx end

pull/3446/head
Victor Julien 7 years ago
parent 55b14f3721
commit a337908c78

@ -18,6 +18,7 @@
use applayer;
use core;
use core::{ALPROTO_UNKNOWN, AppProto, Flow};
use core::{sc_detect_engine_state_free, sc_app_layer_decoder_events_free_events};
use dhcp::parser::*;
use libc;
use log::*;
@ -98,6 +99,25 @@ impl DHCPTransaction {
events: std::ptr::null_mut(),
}
}
pub fn free(&mut self) {
if self.events != std::ptr::null_mut() {
sc_app_layer_decoder_events_free_events(&mut self.events);
}
match self.de_state {
Some(state) => {
sc_detect_engine_state_free(state);
}
_ => {}
}
}
}
impl Drop for DHCPTransaction {
fn drop(&mut self) {
self.free();
}
}
export_tx_get_detect_state!(rs_dhcp_tx_get_detect_state, DHCPTransaction);

Loading…
Cancel
Save