diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-26 19:59:44 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-21 20:43:39 +0200 |
commit | 64c82912a74aee655618f67998c99eda36d2c6bb (patch) | |
tree | 4f6bce22fd53d1df7c16bf0ecac289d7ae47ac47 /libavformat/mp3dec.c | |
parent | 1aaf9613a8741430a48c4470b14e3389d3cf46e6 (diff) | |
download | ffmpeg-64c82912a74aee655618f67998c99eda36d2c6bb.tar.gz |
avformat/mp3dec: properly allocate dummy AVCodecContext
Fixes (harmless) use of uninitialized variable
Found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6ad42b3e15478284321dd285acaf189a16590854)
Conflicts:
libavformat/mp3dec.c
Diffstat (limited to 'libavformat/mp3dec.c')
-rw-r--r-- | libavformat/mp3dec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index c4c1bb7ca5..030b11f3b7 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -61,7 +61,7 @@ static int mp3_read_probe(AVProbeData *p) int fsize, frames, sample_rate; uint32_t header; const uint8_t *buf, *buf0, *buf2, *end; - AVCodecContext avctx; + AVCodecContext *avctx = avcodec_alloc_context3(NULL); buf0 = p->buf; end = p->buf + p->buf_size - sizeof(uint32_t); @@ -78,7 +78,7 @@ static int mp3_read_probe(AVProbeData *p) for(frames = 0; buf2 < end; frames++) { header = AV_RB32(buf2); - fsize = avpriv_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate); + fsize = avpriv_mpa_decode_header(avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate); if(fsize < 0) break; buf2 += fsize; @@ -87,6 +87,7 @@ static int mp3_read_probe(AVProbeData *p) if(buf == buf0) first_frames= frames; } + avcodec_free_context(&avctx); // keep this in sync with ac3 probe, both need to avoid // issues with MPEG-files! if (first_frames>=4) return AVPROBE_SCORE_EXTENSION + 1; |