diff options
author | ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-10 01:43:33 +0000 |
---|---|---|
committer | ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-10 01:43:33 +0000 |
commit | 920a892892fd2ffcd15a6dd415e9bc4e8ca79ac8 (patch) | |
tree | 95b3c23464b195a4e65460c5ad210ca57486be34 /libaf | |
parent | 3b05fa96312452465ccd372262d394b383955781 (diff) |
Fix missing command line bug by making the input parameter constant.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25330 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libaf')
-rw-r--r-- | libaf/af.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libaf/af.c b/libaf/af.c index eb5aa38d36..9ba869715e 100644 --- a/libaf/af.c +++ b/libaf/af.c @@ -102,13 +102,14 @@ af_instance_t* af_get(af_stream_t* s, char* name) /*/ 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_stream_t* s, char* name) 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; } |