fix memory leak when filter with given name does not exist.

Also prints which filter failed in the malloc-failed case


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17781 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2006-03-08 15:39:53 +00:00
parent 93ffd2ad79
commit 694f18ea46
1 changed files with 4 additions and 4 deletions

View File

@ -104,7 +104,7 @@ af_instance_t* af_create(af_stream_t* s, char* name)
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 @@ af_instance_t* af_create(af_stream_t* s, char* name)
// 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 @@ af_instance_t* af_create(af_stream_t* s, char* name)
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 @@ af_instance_t* af_create(af_stream_t* s, char* name)
return new;
}
err_out:
free(new);
af_msg(AF_MSG_ERROR,"[libaf] Couldn't create or open audio filter '%s'\n",
name);