fix(ndpi_main):Fix memory leak about ndpi_str; (#1513)

Co-authored-by: 林文烽 <wenfeng.lin@baishan.com>
This commit is contained in:
Wayne
2022-04-12 15:34:37 +02:00
committed by GitHub
co-authored by 林文烽
parent 06a0abb6fd
commit 939572c61e
+3
View File
@@ -2513,6 +2513,7 @@ struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs
if((sizeof(categories) / sizeof(char *)) != NDPI_PROTOCOL_NUM_CATEGORIES) {
NDPI_LOG_ERR(ndpi_str, "[NDPI] invalid categories length: expected %u, got %u\n", NDPI_PROTOCOL_NUM_CATEGORIES,
(unsigned int) (sizeof(categories) / sizeof(char *)));
ndpi_free(ndpi_str);
return(NULL);
}
@@ -2562,6 +2563,7 @@ struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs
if((ndpi_str->custom_categories.ipAddresses == NULL) || (ndpi_str->custom_categories.ipAddresses_shadow == NULL)) {
NDPI_LOG_ERR(ndpi_str, "[NDPI] Error allocating Patricia trees\n");
ndpi_free(ndpi_str);
return(NULL);
}
@@ -2569,6 +2571,7 @@ struct ndpi_detection_module_struct *ndpi_init_detection_module(ndpi_init_prefs
if(ndpi_callback_init(ndpi_str)) {
NDPI_LOG_ERR(ndpi_str, "[NDPI] Error allocating callbacks\n");
ndpi_free(ndpi_str);
return NULL;
}