diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-07-07 17:07:20 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-07-07 17:07:20 +0200 |
commit | e308e59002539a989e87c72bdb462b9652e304b3 (patch) | |
tree | 33e90dff0d8578d8ea6d03cfd3e539bf31544e20 /src | |
parent | 1c60c22893e465da75b825ce4bab80ca018e9104 (diff) |
fixed memory leak in ndpi_cluster_bins / binUnitTest
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ndpi_analyze.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/ndpi_analyze.c b/src/lib/ndpi_analyze.c index 74adbb2c9..07fc09362 100644 --- a/src/lib/ndpi_analyze.c +++ b/src/lib/ndpi_analyze.c @@ -486,7 +486,7 @@ int ndpi_cluster_bins(struct ndpi_bin *bins, u_int16_t num_bins, if(num_clusters > num_bins) return(-1); - if((centroids = (struct ndpi_bin*)malloc(sizeof(struct ndpi_bin)*num_clusters)) == NULL) + if((centroids = (struct ndpi_bin*)ndpi_malloc(sizeof(struct ndpi_bin)*num_clusters)) == NULL) return(-2); else { for(i=0; i<num_clusters; i++) @@ -571,6 +571,8 @@ int ndpi_cluster_bins(struct ndpi_bin *bins, u_int16_t num_bins, for(i=0; i<num_clusters; i++) ndpi_free_bin(¢roids[i]); + ndpi_free(centroids); + return(0); } |