You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avfilter/vf_thumbnail_cuda: Fix segfaults on uninit
Uninit crashed if an array containing frames could not be allocated or config_props() has never been called. Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -306,6 +306,8 @@ static av_cold void uninit(AVFilterContext *ctx)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
ThumbnailCudaContext *s = ctx->priv;
|
ThumbnailCudaContext *s = ctx->priv;
|
||||||
|
|
||||||
|
if (s->hwctx) {
|
||||||
CudaFunctions *cu = s->hwctx->internal->cuda_dl;
|
CudaFunctions *cu = s->hwctx->internal->cuda_dl;
|
||||||
|
|
||||||
if (s->data) {
|
if (s->data) {
|
||||||
@@ -317,10 +319,13 @@ static av_cold void uninit(AVFilterContext *ctx)
|
|||||||
CHECK_CU(cu->cuModuleUnload(s->cu_module));
|
CHECK_CU(cu->cuModuleUnload(s->cu_module));
|
||||||
s->cu_module = NULL;
|
s->cu_module = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s->frames) {
|
||||||
for (i = 0; i < s->n_frames && s->frames[i].buf; i++)
|
for (i = 0; i < s->n_frames && s->frames[i].buf; i++)
|
||||||
av_frame_free(&s->frames[i].buf);
|
av_frame_free(&s->frames[i].buf);
|
||||||
av_freep(&s->frames);
|
av_freep(&s->frames);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_frame(AVFilterLink *link)
|
static int request_frame(AVFilterLink *link)
|
||||||
|
Reference in New Issue
Block a user