dec_sub: avoid segfault on sub_init_decoder failure

Broken by commit 687b552d.

Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
Aman Gupta 2015-12-21 17:16:14 -08:00 committed by wm4
parent d5274d9298
commit f8b09658f4
1 changed files with 2 additions and 1 deletions

View File

@ -166,7 +166,8 @@ void sub_init_from_sh(struct dec_sub *sub, struct sh_stream *sh)
*sd = init_sd;
if (sub_init_decoder(sub, sd) < 0) {
sd->driver->uninit(sd);
if (sd->driver && sd->driver->uninit)
sd->driver->uninit(sd);
talloc_free(sd);
MP_ERR(sub, "Could not find subtitle decoder for format '%s'.\n",
sh->codec ? sh->codec : "<unknown>");