mirror of https://git.ffmpeg.org/ffmpeg.git
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 459db51271
)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
23ae7bfb4e
commit
94e2673f4e
|
@ -411,8 +411,10 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
|
||||||
AV_WL32(pkt->data , nblocks);
|
AV_WL32(pkt->data , nblocks);
|
||||||
AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
|
AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
|
||||||
ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
|
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;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
pkt->pts = ape->frames[ape->currentframe].pts;
|
pkt->pts = ape->frames[ape->currentframe].pts;
|
||||||
pkt->stream_index = 0;
|
pkt->stream_index = 0;
|
||||||
|
|
Loading…
Reference in New Issue