aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-23 18:09:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-21 16:42:32 +0100
commit94e2673f4e455df61073b0ed4e46545149b5f8ce (patch)
tree55fd45e476339fdd6ac41214c1fc8c688716e1e5
parent23ae7bfb4e94a13204f7b5d09e7d9f87f795d698 (diff)
downloadffmpeg-94e2673f4e455df61073b0ed4e46545149b5f8ce.tar.gz
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> (cherry picked from commit 459db51271807ba26162db7b67ac1ff444cc0fa9) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/ape.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 613a59d5f8..05013045fb 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -411,8 +411,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;