History

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.

Andreas Rheinhardt committed 5 years ago

Commit 06045f41 parent baf89ab1 file · +5 −0Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_thumbnail_cuda.c+5−0
@@ -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
326static int request_frame(AVFilterLink *link)331static int request_frame(AVFilterLink *link)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t