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.
This commit is contained in:
wm4 2013-02-21 21:53:10 +01:00
parent 0bad744d68
commit 2f6257e2f4
1 changed files with 1 additions and 1 deletions

View File

@ -157,7 +157,7 @@ static int init(sh_video_t *sh, const char *decoder)
if (hwdec) { if (hwdec) {
AVCodec *lavc_hwcodec = avcodec_find_decoder_by_name(hwdec->hw_codec); AVCodec *lavc_hwcodec = avcodec_find_decoder_by_name(hwdec->hw_codec);
if (lavc_hwcodec) { if (lavc_hwcodec) {
ctx->software_fallback_decoder = decoder; ctx->software_fallback_decoder = talloc_strdup(ctx, decoder);
decoder = lavc_hwcodec->name; decoder = lavc_hwcodec->name;
} else { } else {
hwdec = NULL; hwdec = NULL;