[MPlayer-dev-eng] [PATCH] String/memory handling in libao/audio_dec.c

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Wed Oct 13 12:52:04 CEST 2004


Hi,
> This looks fishy:
> 
>> 	ao_subdevice=strchr(ao,':');
>> 	if(ao_subdevice){
>>-	    ao_subdevice[0]=0;
>>-	    ++ao_subdevice;
>>+	    ao_len = ao_subdevice - ao;
>>+	    ao_subdevice = strdup(&ao[ao_len + 1]);
>> 	}
>>+	else
>>+	    ao_len = strlen(ao);
> 
> ...
> 
>>+    if (ao_subdevice) {
>>+      free(ao_subdevice);
>>+      ao_subdevice = NULL;
>>+    }

You mean because of the if() before doing free()? That's because the 
above is a while-loop that might never be executed.
If you mean because of the free down there, that's because we only get 
there if we couldn't use any of the ao specified on the commandline (if 
init worked for one of them, return is called.

Greetings,
Reimar Döffinger




More information about the MPlayer-dev-eng mailing list