aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampus <campus@ntop.org>2018-01-05 00:34:33 +0100
committerCampus <campus@ntop.org>2018-01-05 00:34:33 +0100
commit61e297b851af570109e72a93a65b1ac5ccfda0b4 (patch)
treeba27c9be3ea9ebbfa33522b28bd6103ef2e381b7
parent1d1082342f608d37a4abcdf18c3e7e60c8734b05 (diff)
add missing check for free TCP/UDP root in tree
-rw-r--r--src/lib/ndpi_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 13a216b1d..e1979fbb2 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -2041,8 +2041,10 @@ void ndpi_exit_detection_module(struct ndpi_detection_module_struct *ndpi_struct
if(ndpi_struct->protocols_ptree)
ndpi_Destroy_Patricia((patricia_tree_t*)ndpi_struct->protocols_ptree, free_ptree_data);
- ndpi_tdestroy(ndpi_struct->udpRoot, ndpi_free);
- ndpi_tdestroy(ndpi_struct->tcpRoot, ndpi_free);
+ if (ndpi_struct->udpRoot != NULL)
+ ndpi_tdestroy(ndpi_struct->udpRoot, ndpi_free);
+ if (ndpi_struct->tcpRoot != NULL)
+ ndpi_tdestroy(ndpi_struct->tcpRoot, ndpi_free);
if(ndpi_struct->host_automa.ac_automa != NULL)
ac_automata_release((AC_AUTOMATA_t*)ndpi_struct->host_automa.ac_automa);