You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/sunrast: fix leak in sunrast_decode_frame()
In sunrast_decode_frame(), we use av_malloc_array() allocates memory to ptr and ptr2. However if buf_end - buf < 1, this function returns error code without freeing this memory thus cause a leak. Add av_freep() before return. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
7ed5a7094f
commit
98afcd3da7
@ -163,8 +163,10 @@ static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p,
|
|||||||
x = 0;
|
x = 0;
|
||||||
while (ptr != end && buf < buf_end) {
|
while (ptr != end && buf < buf_end) {
|
||||||
run = 1;
|
run = 1;
|
||||||
if (buf_end - buf < 1)
|
if (buf_end - buf < 1) {
|
||||||
|
av_freep(&ptr2);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
if ((value = *buf++) == RLE_TRIGGER) {
|
if ((value = *buf++) == RLE_TRIGGER) {
|
||||||
run = *buf++ + 1;
|
run = *buf++ + 1;
|
||||||
|
Reference in New Issue
Block a user