diff --git a/player/lavfi.c b/player/lavfi.c index ada66e7475..50c2fd8fc2 100644 --- a/player/lavfi.c +++ b/player/lavfi.c @@ -339,7 +339,7 @@ static bool init_pads(struct lavfi *c) goto error; // can happen if pad reassociation fails if (pad->dir == LAVFI_OUT) { - AVFilter *dst_filter; + AVFilter *dst_filter = NULL; if (pad->type == STREAM_AUDIO) { dst_filter = avfilter_get_by_name("abuffersink"); } else if (pad->type == STREAM_VIDEO) { @@ -348,6 +348,9 @@ static bool init_pads(struct lavfi *c) assert(0); } + if (!dst_filter) + goto error; + char name[256]; snprintf(name, sizeof(name), "mpv_sink_%s", pad->name); @@ -359,7 +362,7 @@ static bool init_pads(struct lavfi *c) goto error; } else { char src_args[256]; - AVFilter *src_filter; + AVFilter *src_filter = NULL; pad->input_eof |= !pad->connected; @@ -410,6 +413,9 @@ static bool init_pads(struct lavfi *c) assert(0); } + if (!src_filter) + goto error; + char name[256]; snprintf(name, sizeof(name), "mpv_src_%s", pad->name);