From 7010269f3bc74c764f5b4e9c72dd069ce34fb244 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo@altea>
Date: Wed, 18 May 2016 17:56:30 +0000
Subject: [PATCH] Fix in memory leak. There were also leaks in the old code probably.

---
 src/tsmeasure.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/tsmeasure.c b/src/tsmeasure.c
index 9190648..6bd5f5c 100644
--- a/src/tsmeasure.c
+++ b/src/tsmeasure.c
@@ -34,9 +34,9 @@
 }
 
 void vesicle_calculate_ulm2(ts_vesicle *vesicle){
-	complex_sph_free(vesicle->sphHarmonics);
+	//complex_sph_free(vesicle->sphHarmonics);
 
-	vesicle->sphHarmonics=complex_sph_init(vesicle->vlist,21);
+	//vesicle->sphHarmonics=complex_sph_init(vesicle->vlist,21);
 	vesicle_volume(vesicle);
 	preparationSh(vesicle,getR0(vesicle));
 	calculateUlmComplex(vesicle);
@@ -68,8 +68,7 @@
 		ent=list[n];	
             	i=rindex(ent->d_name,'.');
             	if(i==NULL) {
-			free(ent);  
-			continue;
+				continue;
 		}
             	if(strcmp(i+1,"vtu")==0){
                     j=rindex(ent->d_name,'_');
@@ -79,14 +78,20 @@
                     ts_fprintf(stdout,"timestep: %u filename: %s\n",atoi(number),ent->d_name);
 			printf("%u ",atoi(number));
 			vesicle=restoreVesicle(ent->d_name);
-			vesicle_calculate_ulm2(vesicle);
+//			vesicle_calculate_ulm2(vesicle);
                     	tstep++;
 			//vesicle_free(vesicle);
                     free(number);
+			tape_free(vesicle->tape);
 			vesicle_free(vesicle);
             	}
 		free(ent);  
 		}
+	for (n = 0; n < count; n++)
+  	{
+  		free(list[n]);
+  	}
+	
 	free(list);
 	return 0;
 }

--
Gitblit v1.9.3