[MPlayer-cvslog] r22197 - in trunk/libaf: af_channels.c af_format.c af_hrtf.c af_lavcresample.c af_resample.c

uau subversion at mplayerhq.hu
Sat Feb 10 19:12:03 CET 2007


Author: uau
Date: Sat Feb 10 19:12:03 2007
New Revision: 22197

Modified:
   trunk/libaf/af_channels.c
   trunk/libaf/af_format.c
   trunk/libaf/af_hrtf.c
   trunk/libaf/af_lavcresample.c
   trunk/libaf/af_resample.c

Log:
Fix memory leaks.


Modified: trunk/libaf/af_channels.c
==============================================================================
--- trunk/libaf/af_channels.c	(original)
+++ trunk/libaf/af_channels.c	Sat Feb 10 19:12:03 2007
@@ -234,10 +234,10 @@
 // Deallocate memory 
 static void uninit(struct af_instance_s* af)
 {
-  if(af->setup)
-    free(af->setup);
-  if(af->data)
-    free(af->data);
+  free(af->setup);
+  if (af->data)
+      free(af->data->audio);
+  free(af->data);
 }
 
 // Filter data through filter

Modified: trunk/libaf/af_format.c
==============================================================================
--- trunk/libaf/af_format.c	(original)
+++ trunk/libaf/af_format.c	Sat Feb 10 19:12:03 2007
@@ -163,8 +163,9 @@
 // Deallocate memory 
 static void uninit(struct af_instance_s* af)
 {
-  if(af->data)
-    free(af->data);
+  if (af->data)
+      free(af->data->audio);
+  free(af->data);
   af->setup = 0;  
 }
 

Modified: trunk/libaf/af_hrtf.c
==============================================================================
--- trunk/libaf/af_hrtf.c	(original)
+++ trunk/libaf/af_hrtf.c	Sat Feb 10 19:12:03 2007
@@ -362,7 +362,8 @@
 	free(af->setup);
     }
     if(af->data)
-	free(af->data);
+	free(af->data->audio);
+    free(af->data);
 }
 
 /* Filter data through filter

Modified: trunk/libaf/af_lavcresample.c
==============================================================================
--- trunk/libaf/af_lavcresample.c	(original)
+++ trunk/libaf/af_lavcresample.c	Sat Feb 10 19:12:03 2007
@@ -79,10 +79,14 @@
 static void uninit(struct af_instance_s* af)
 {
     if(af->data)
-        free(af->data);
+        free(af->data->audio);
+    free(af->data);
     if(af->setup){
         af_resample_t *s = af->setup;
         if(s->avrctx) av_resample_close(s->avrctx);
+	int i;
+	for (i=0; i < AF_NCH; i++)
+	    free(s->in[i]);
         free(s);
     }
 }
@@ -109,7 +113,7 @@
   if(s->in_alloc < in_len + s->index){
       s->in_alloc= in_len + s->index;
       for(i=0; i<chans; i++){
-          s->in[i]= realloc(s->in[i], s->in_alloc*sizeof(int16_t)); //FIXME free this maybe ;)
+          s->in[i]= realloc(s->in[i], s->in_alloc*sizeof(int16_t));
       }
   }
 

Modified: trunk/libaf/af_resample.c
==============================================================================
--- trunk/libaf/af_resample.c	(original)
+++ trunk/libaf/af_resample.c	Sat Feb 10 19:12:03 2007
@@ -298,7 +298,8 @@
 static void uninit(struct af_instance_s* af)
 {
   if(af->data)
-    free(af->data);
+    free(af->data->audio);
+  free(af->data);
 }
 
 // Filter data through filter



More information about the MPlayer-cvslog mailing list