aboutsummaryrefslogtreecommitdiff
path: root/example/ndpiReader.c
diff options
context:
space:
mode:
authorMichele Campus <fci1908@gmail.com>2015-07-19 01:21:37 +0200
committerMichele Campus <fci1908@gmail.com>2015-07-19 01:21:37 +0200
commit0d68f8ab5d92a9021b91702913cc973eb98a9235 (patch)
tree3ad4486192d1d43bb550d84cf7fd25fa119cb3a7 /example/ndpiReader.c
parent73358d5ec2f877ca30ac0b20c12530d1f338ca5b (diff)
added free for flow in get_ndpi_flow - deleted dead part in ndpi_typedef.c
Diffstat (limited to 'example/ndpiReader.c')
-rw-r--r--example/ndpiReader.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 4ef08091a..c11c0c50d 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -575,6 +575,7 @@ static void free_ndpi_flow(struct ndpi_flow *flow) {
if(flow->ndpi_flow) { ndpi_free_flow(flow->ndpi_flow); flow->ndpi_flow = NULL; }
if(flow->src_id) { ndpi_free(flow->src_id); flow->src_id = NULL; }
if(flow->dst_id) { ndpi_free(flow->dst_id); flow->dst_id = NULL; }
+
}
/* ***************************************************** */
@@ -845,18 +846,21 @@ static struct ndpi_flow *get_ndpi_flow(u_int16_t thread_id,
if((newflow->ndpi_flow = malloc_wrapper(size_flow_struct)) == NULL) {
printf("[NDPI] %s(2): not enough memory\n", __FUNCTION__);
+ free(newflow);
return(NULL);
} else
memset(newflow->ndpi_flow, 0, size_flow_struct);
if((newflow->src_id = malloc_wrapper(size_id_struct)) == NULL) {
printf("[NDPI] %s(3): not enough memory\n", __FUNCTION__);
+ free(newflow);
return(NULL);
} else
memset(newflow->src_id, 0, size_id_struct);
if((newflow->dst_id = malloc_wrapper(size_id_struct)) == NULL) {
printf("[NDPI] %s(4): not enough memory\n", __FUNCTION__);
+ free(newflow);
return(NULL);
} else
memset(newflow->dst_id, 0, size_id_struct);
@@ -868,7 +872,7 @@ static struct ndpi_flow *get_ndpi_flow(u_int16_t thread_id,
// printFlow(thread_id, newflow);
- return(newflow);
+ return newflow ;
}
} else {
struct ndpi_flow *flow = *(struct ndpi_flow**)ret;