mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avcodec/mjpegenc: Fix segfault when freeing incomplete context
When allocating the MJpegContext fails (or if the dimensions run afoul
of the 65500x65500 limit), an attempt to free a subbuffer of said
context leads to a segfault in ff_mjpeg_encode_close().
Seems to be a regression since 467d9e27e0
.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
e5d6af7b35
commit
84ac35ecb8
@ -312,8 +312,10 @@ av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
|
||||
|
||||
av_cold void ff_mjpeg_encode_close(MpegEncContext *s)
|
||||
{
|
||||
av_freep(&s->mjpeg_ctx->huff_buffer);
|
||||
av_freep(&s->mjpeg_ctx);
|
||||
if (s->mjpeg_ctx) {
|
||||
av_freep(&s->mjpeg_ctx->huff_buffer);
|
||||
av_freep(&s->mjpeg_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user