comparison libmpdemux/demux_lavf.c @ 29343:28486169f9e0

Move allocation to avoid a possible memleak if new_sh_audio fails.
author reimar
date Wed, 24 Jun 2009 08:06:46 +0000
parents ec913e932635
children fb8ad1c8b5d6
comparison
equal deleted inserted replaced
29342:ec913e932635 29343:28486169f9e0
223 int g; 223 int g;
224 224
225 switch(codec->codec_type){ 225 switch(codec->codec_type){
226 case CODEC_TYPE_AUDIO:{ 226 case CODEC_TYPE_AUDIO:{
227 int override_tag; 227 int override_tag;
228 WAVEFORMATEX *wf= calloc(sizeof(WAVEFORMATEX) + codec->extradata_size, 1); 228 WAVEFORMATEX *wf;
229 sh_audio_t* sh_audio; 229 sh_audio_t* sh_audio;
230 sh_audio=new_sh_audio(demuxer, i); 230 sh_audio=new_sh_audio(demuxer, i);
231 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "lavf", i); 231 mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "lavf", i);
232 if(!sh_audio) 232 if(!sh_audio)
233 break; 233 break;
234 priv->astreams[priv->audio_streams] = i; 234 priv->astreams[priv->audio_streams] = i;
235 priv->audio_streams++; 235 priv->audio_streams++;
236 wf= calloc(sizeof(WAVEFORMATEX) + codec->extradata_size, 1);
236 // For some formats (like PCM) always trust CODEC_ID_* more than codec_tag 237 // For some formats (like PCM) always trust CODEC_ID_* more than codec_tag
237 override_tag= av_codec_get_tag(mp_wav_override_taglists, codec->codec_id); 238 override_tag= av_codec_get_tag(mp_wav_override_taglists, codec->codec_id);
238 if (override_tag) 239 if (override_tag)
239 codec->codec_tag= override_tag; 240 codec->codec_tag= override_tag;
240 // mp4a tag is used for all mp4 files no matter what they actually contain 241 // mp4a tag is used for all mp4 files no matter what they actually contain