Uninit crashed if an array containing frames could not be allocated or config_props() has never been called.
Unified · Split
| @@ -306,6 +306,8 @@ static av_cold void uninit(AVFilterContext *ctx) · 305 unmodified lines | |||
| 306 | { | 306 | { |
| 307 | int i; | 307 | int i; |
| 308 | ThumbnailCudaContext *s = ctx->priv; | 308 | ThumbnailCudaContext *s = ctx->priv; |
| 309 | |||
| 310 | if (s->hwctx) { | ||
| 309 | CudaFunctions *cu = s->hwctx->internal->cuda_dl; | 311 | CudaFunctions *cu = s->hwctx->internal->cuda_dl; |
| 310 | 312 | ||
| 311 | if (s->data) { | 313 | if (s->data) { |
| @@ -317,10 +319,13 @@ static av_cold void uninit(AVFilterContext *ctx) · 5 unmodified lines | |||
| 317 | CHECK_CU(cu->cuModuleUnload(s->cu_module)); | 319 | CHECK_CU(cu->cuModuleUnload(s->cu_module)); |
| 318 | s->cu_module = NULL; | 320 | s->cu_module = NULL; |
| 319 | } | 321 | } |
| 322 | } | ||
| 320 | 323 | ||
| 324 | if (s->frames) { | ||
| 321 | for (i = 0; i < s->n_frames && s->frames[i].buf; i++) | 325 | for (i = 0; i < s->n_frames && s->frames[i].buf; i++) |
| 322 | av_frame_free(&s->frames[i].buf); | 326 | av_frame_free(&s->frames[i].buf); |
| 323 | av_freep(&s->frames); | 327 | av_freep(&s->frames); |
| 328 | } | ||
| 324 | } | 329 | } |
| 325 | 330 | ||
| 326 | static int request_frame(AVFilterLink *link) | 331 | static int request_frame(AVFilterLink *link) |