[MPlayer-cvslog] r25330 - trunk/libaf/af.c

ulion subversion at mplayerhq.hu
Mon Dec 10 02:43:33 CET 2007


Author: ulion
Date: Mon Dec 10 02:43:33 2007
New Revision: 25330

Log:
Fix missing command line bug by making the input parameter constant.


Modified:
   trunk/libaf/af.c

Modified: trunk/libaf/af.c
==============================================================================
--- trunk/libaf/af.c	(original)
+++ trunk/libaf/af.c	Mon Dec 10 02:43:33 2007
@@ -102,13 +102,14 @@ af_instance_t* af_get(af_stream_t* s, ch
 
 /*/ Function for creating a new filter of type name. The name may
   contain the commandline parameters for the filter */
-static af_instance_t* af_create(af_stream_t* s, char* name)
+static af_instance_t* af_create(af_stream_t* s, const char* name_with_cmd)
 {
+  char* name = strdup(name_with_cmd);
   char* cmdline = name;
 
   // Allocate space for the new filter and reset all pointers
   af_instance_t* new=malloc(sizeof(af_instance_t));
-  if(!new){
+  if (!name || !new) {
     af_msg(AF_MSG_ERROR,"[libaf] Could not allocate memory\n");
     goto err_out;
   }  
@@ -137,17 +138,18 @@ static af_instance_t* af_create(af_strea
   if(AF_OK == new->info->open(new) && 
      AF_ERROR < new->control(new,AF_CONTROL_POST_CREATE,&s->cfg)){
     if(cmdline){
-      if(AF_ERROR<new->control(new,AF_CONTROL_COMMAND_LINE,cmdline))
-	return new;
+      if(!AF_ERROR<new->control(new,AF_CONTROL_COMMAND_LINE,cmdline))
+        goto err_out;
     }
-    else
-      return new; 
+    free(name);
+    return new; 
   }
   
 err_out:
   free(new);
   af_msg(AF_MSG_ERROR,"[libaf] Couldn't create or open audio filter '%s'\n",
 	 name);  
+  free(name);
   return NULL;
 }
 



More information about the MPlayer-cvslog mailing list