diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 1e316687d8565..c03393a007e41 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -445,12 +445,14 @@ char *sub_get_text(struct dec_sub *sub, double pts, enum sd_text_type type) char *sub_ass_get_extradata(struct dec_sub *sub) { + char *data = NULL; mp_mutex_lock(&sub->lock); if (strcmp(sub->sd->codec->codec, "ass") != 0) - return NULL; + goto done; char *extradata = sub->sd->codec->extradata; int extradata_size = sub->sd->codec->extradata_size; - char *data = talloc_strndup(NULL, extradata, extradata_size); + data = talloc_strndup(NULL, extradata, extradata_size); +done: mp_mutex_unlock(&sub->lock); return data; }