Merge pull request #806 from oleg-umnik/fix_1

Don't leak memory in live capture mode
This commit is contained in:
Luca Deri
2019-11-03 17:13:49 +01:00
committed by GitHub
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -1805,6 +1805,7 @@ static void node_idle_scan_walker(const void *node, ndpi_VISIT which, int depth,
undetected_flows_deleted = 1;
ndpi_free_flow_info_half(flow);
ndpi_free_flow_data_analysis(flow);
ndpi_thread_info[thread_id].workflow->stats.ndpi_flow_count--;
/* adding to a queue (we can't delete it from the tree inline ) */
+8 -2
View File
@@ -457,6 +457,14 @@ void ndpi_flow_info_freer(void *node) {
ndpi_free_flow_info_half(flow);
ndpi_free_flow_data_analysis(flow);
ndpi_free(flow);
}
/* ***************************************************** */
void ndpi_free_flow_data_analysis(struct ndpi_flow_info *flow) {
if(flow->iat_c_to_s) ndpi_free_data_analysis(flow->iat_c_to_s);
if(flow->iat_s_to_c) ndpi_free_data_analysis(flow->iat_s_to_c);
@@ -464,8 +472,6 @@ void ndpi_flow_info_freer(void *node) {
if(flow->pktlen_s_to_c) ndpi_free_data_analysis(flow->pktlen_s_to_c);
if(flow->iat_flow) ndpi_free_data_analysis(flow->iat_flow);
ndpi_free(flow);
}
/* ***************************************************** */
+1
View File
@@ -303,6 +303,7 @@ int ndpi_workflow_node_cmp(const void *a, const void *b);
void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_flow_info *flow);
u_int32_t ethernet_crc32(const void* data, size_t n_bytes);
void ndpi_flow_info_freer(void *node);
void ndpi_free_flow_data_analysis(struct ndpi_flow_info *flow);
const char* print_cipher_id(u_int32_t cipher);
float ndpi_flow_get_byte_count_entropy(const uint32_t byte_count[256], unsigned int num_bytes);