diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-23 21:09:58 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-25 05:32:40 +0400 |
commit | 459db51271807ba26162db7b67ac1ff444cc0fa9 (patch) | |
tree | d95edc054d2d6e978c46f5b1dd72f87bb8cbae3c /libavformat/ape.c | |
parent | 804ea14b3564be53487d490c7f9f02c039542832 (diff) |
avformat/ape: free packet on avio_read() failure
Fixes memleak
Fixes: msan_uninit-mem_7fcc198b365b_8417_sh3.ape
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/ape.c')
-rw-r--r-- | libavformat/ape.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/ape.c b/libavformat/ape.c index 4e6e6bde31..b677ba9593 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -417,8 +417,10 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) AV_WL32(pkt->data , nblocks); AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip); ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size); - if (ret < 0) + if (ret < 0) { + av_free_packet(pkt); return ret; + } pkt->pts = ape->frames[ape->currentframe].pts; pkt->stream_index = 0; |