ffmpeg | branch: master | Andreas Rheinhardt <[email protected]> | 
Tue Oct  5 22:31:03 2021 +0200| [06045f4b1da1cbfa3446beef6797fb983a7dada5] | 
committer: 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: Timo Rothenpieler <[email protected]>
Signed-off-by: Andreas Rheinhardt <[email protected]>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06045f4b1da1cbfa3446beef6797fb983a7dada5
---

 libavfilter/vf_thumbnail_cuda.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/vf_thumbnail_cuda.c b/libavfilter/vf_thumbnail_cuda.c
index 491542c60a..7c86203227 100644
--- a/libavfilter/vf_thumbnail_cuda.c
+++ b/libavfilter/vf_thumbnail_cuda.c
@@ -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)

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to