aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-26 19:59:44 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-26 20:02:23 +0100
commit6ad42b3e15478284321dd285acaf189a16590854 (patch)
treea0d8c1c15bbf5e9df97d9d097333e37136e39ac5
parent51b7ab2ee70fa6f8f5ee2f7339e92d60ded57834 (diff)
downloadffmpeg-6ad42b3e15478284321dd285acaf189a16590854.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>
-rw-r--r--libavformat/mp3dec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 480cffedad..44de9b57e7 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -61,7 +61,7 @@ static int mp3_read_probe(AVProbeData *p)
int fsize, frames;
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);
@@ -79,7 +79,7 @@ static int mp3_read_probe(AVProbeData *p)
for(frames = 0; buf2 < end; frames++) {
int dummy;
header = AV_RB32(buf2);
- fsize = avpriv_mpa_decode_header(&avctx, header, &dummy, &dummy, &dummy, &dummy);
+ fsize = avpriv_mpa_decode_header(avctx, header, &dummy, &dummy, &dummy, &dummy);
if(fsize < 0)
break;
buf2 += fsize;
@@ -88,6 +88,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;