mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-01 12:22:09 +00:00
avcodec/pngdec: Fix memleak by postponing allocation
Fixes Coverity ticket #1322342. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
da12d600ea
commit
5edcdfc318
@ -1080,10 +1080,6 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = av_malloc_array(s->image_linesize, s->height);
|
|
||||||
if (!buffer)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
|
|
||||||
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
|
ff_thread_await_progress(&s->last_picture, INT_MAX, 0);
|
||||||
|
|
||||||
// need to reset a rectangle to background:
|
// need to reset a rectangle to background:
|
||||||
@ -1099,7 +1095,9 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(buffer, s->last_picture.f->data[0], s->image_linesize * s->height);
|
buffer = av_memdup(s->last_picture.f->data[0], s->image_linesize * s->height);
|
||||||
|
if (!buffer)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
// Perform blending
|
// Perform blending
|
||||||
if (s->blend_op == APNG_BLEND_OP_SOURCE) {
|
if (s->blend_op == APNG_BLEND_OP_SOURCE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user