diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-06-24 08:06:46 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-06-24 08:06:46 +0000 |
commit | bc8b79a37dbd54aeb4782738a566bb6353f3df4e (patch) | |
tree | 17440e4a0aca0a0d613da0b0787ebfab349160a8 /libmpdemux | |
parent | 6a434d676b48dbdb05d81244d35f06685160e097 (diff) |
Move allocation to avoid a possible memleak if new_sh_audio fails.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29385 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_lavf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 7df20ac682..31715b159e 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -225,7 +225,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { 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 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { 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) |