From 939572c61ec27ea63b7e0f2d6a4d18f767e6195d Mon Sep 17 00:00:00 2001 From: Wayne <52459720+HiWFeng@users.noreply.github.com> Date: Tue, 12 Apr 2022 21:34:37 +0800 Subject: fix(ndpi_main):Fix memory leak about ndpi_str; (#1513) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 林文烽 --- src/lib/ndpi_main.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lib/ndpi_main.c') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index e007bf2b0..005f215d2 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -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; } -- cgit v1.2.3