[MPlayer-cvslog] CVS: main/libaf af.c,1.51,1.52

Reimar Döffinger CVS syncmail at mplayerhq.hu
Wed Mar 8 16:39:55 CET 2006


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libaf
In directory mail:/var2/tmp/cvs-serv13690

Modified Files:
	af.c 
Log Message:
fix memory leak when filter with given name does not exist.
Also prints which filter failed in the malloc-failed case


Index: af.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- af.c	20 Oct 2005 09:12:28 -0000	1.51
+++ af.c	8 Mar 2006 15:39:53 -0000	1.52
@@ -104,7 +104,7 @@
   af_instance_t* new=malloc(sizeof(af_instance_t));
   if(!new){
     af_msg(AF_MSG_ERROR,"[libaf] Could not allocate memory\n");
-    return NULL;
+    goto err_out;
   }  
   memset(new,0,sizeof(af_instance_t));
 
@@ -113,7 +113,7 @@
 
   // Find filter from name
   if(NULL == (new->info=af_find(name)))
-    return NULL;
+    goto err_out;
 
   /* Make sure that the filter is not already in the list if it is
      non-reentrant */
@@ -121,8 +121,7 @@
     if(af_get(s,name)){
       af_msg(AF_MSG_ERROR,"[libaf] There can only be one instance of" 
 	     " the filter '%s' in each stream\n",name);  
-      free(new);
-      return NULL;
+      goto err_out;
     }
   }
   
@@ -139,6 +138,7 @@
       return new; 
   }
   
+err_out:
   free(new);
   af_msg(AF_MSG_ERROR,"[libaf] Couldn't create or open audio filter '%s'\n",
 	 name);  




More information about the MPlayer-cvslog mailing list