# HG changeset patch # User reimar # Date 1245830806 0 # Node ID 28486169f9e08ce7421834e564b4c0de45170685 # Parent ec913e9326352e1ef6c70442a2a3741ea424a3fb Move allocation to avoid a possible memleak if new_sh_audio fails. diff -r ec913e932635 -r 28486169f9e0 libmpdemux/demux_lavf.c --- a/libmpdemux/demux_lavf.c Wed Jun 24 08:04:38 2009 +0000 +++ b/libmpdemux/demux_lavf.c Wed Jun 24 08:06:46 2009 +0000 @@ -225,7 +225,7 @@ switch(codec->codec_type){ case CODEC_TYPE_AUDIO:{ int override_tag; - WAVEFORMATEX *wf= calloc(sizeof(WAVEFORMATEX) + codec->extradata_size, 1); + WAVEFORMATEX *wf; sh_audio_t* sh_audio; sh_audio=new_sh_audio(demuxer, i); mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "lavf", i); @@ -233,6 +233,7 @@ break; priv->astreams[priv->audio_streams] = i; priv->audio_streams++; + wf= calloc(sizeof(WAVEFORMATEX) + codec->extradata_size, 1); // For some formats (like PCM) always trust CODEC_ID_* more than codec_tag override_tag= av_codec_get_tag(mp_wav_override_taglists, codec->codec_id); if (override_tag)