[FFmpeg-cvslog] avformat/ape: free packet on avio_read() failure
Michael Niedermayer
git at videolan.org
Tue Jan 21 16:57:47 CET 2014
ffmpeg | branch: release/2.1 | Michael Niedermayer <michaelni at gmx.at> | Mon Dec 23 18:09:58 2013 +0100| [94e2673f4e455df61073b0ed4e46545149b5f8ce] | committer: Michael Niedermayer
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 at gmx.at>
(cherry picked from commit 459db51271807ba26162db7b67ac1ff444cc0fa9)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94e2673f4e455df61073b0ed4e46545149b5f8ce
---
libavformat/ape.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 613a59d..0501304 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;
More information about the ffmpeg-cvslog
mailing list