From ca175871cd509f5bd629597c1e0417d4243b9742 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 10 Nov 2016 08:39:09 +0100 Subject: vdpau: fix hwdec uninit This is a bit unintuitiv, but it appears hwdec backends have to unset hwdec_priv manually in their uninit function. Normally with this idiom you'd expect the common code to do this (and maybe even freeing the priv struct). Since other hwdec backends do this quite consistently, just fix vdpau for now. Also add an assert to detect similar bugs sooner. Fixes #3788. --- video/decode/vd_lavc.c | 1 + video/decode/vdpau.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'video') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 72209f5048..d25c99981e 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -598,6 +598,7 @@ static void uninit_avctx(struct dec_video *vd) if (ctx->hwdec && ctx->hwdec->uninit) ctx->hwdec->uninit(ctx); ctx->hwdec = NULL; + assert(ctx->hwdec_priv == NULL); av_freep(&ctx->avctx); diff --git a/video/decode/vdpau.c b/video/decode/vdpau.c index a86f5d1edf..93a1e6d9a3 100644 --- a/video/decode/vdpau.c +++ b/video/decode/vdpau.c @@ -86,7 +86,7 @@ static void uninit(struct lavc_ctx *ctx) XCloseDisplay(p->display); } - talloc_free(p); + TA_FREEP(&ctx->hwdec_priv); if (ctx->avctx) av_freep(&ctx->avctx->hwaccel_context); -- cgit v1.2.3