From 2f6257e2f40a0f559b20cc2989778c6805e892fa Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 21 Feb 2013 21:53:10 +0100 Subject: [PATCH] vd_lavc: fix software decoding fallback The string is deallocated by the callee after initialization, so fallback at runtime passes a deallocated string to libavcodec, which results in random crashes. Regression introduced by commit 4d016a9. --- video/decode/vd_lavc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 9a8aa41888..4f99a00603 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -157,7 +157,7 @@ static int init(sh_video_t *sh, const char *decoder) if (hwdec) { AVCodec *lavc_hwcodec = avcodec_find_decoder_by_name(hwdec->hw_codec); if (lavc_hwcodec) { - ctx->software_fallback_decoder = decoder; + ctx->software_fallback_decoder = talloc_strdup(ctx, decoder); decoder = lavc_hwcodec->name; } else { hwdec = NULL;