Commit 06045f4b authored by Andreas Rheinhardt's avatar Andreas Rheinhardt

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: 's avatarTimo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
parent baf89ab9
......@@ -306,6 +306,8 @@ static av_cold void uninit(AVFilterContext *ctx)
{
int i;
ThumbnailCudaContext *s = ctx->priv;
if (s->hwctx) {
CudaFunctions *cu = s->hwctx->internal->cuda_dl;
if (s->data) {
......@@ -317,10 +319,13 @@ static av_cold void uninit(AVFilterContext *ctx)
CHECK_CU(cu->cuModuleUnload(s->cu_module));
s->cu_module = NULL;
}
}
if (s->frames) {
for (i = 0; i < s->n_frames && s->frames[i].buf; i++)
av_frame_free(&s->frames[i].buf);
av_freep(&s->frames);
}
}
static int request_frame(AVFilterLink *link)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment