lavu/tx: do not unconditionally free subcontexts if initialization fails

If a codelet initializes 2 subtransforms, and the second one fails,
the failure would free all subcontexts.
Instead, if there are subcontexts still left, don't free the array.
If all initializations fail, the init() function will return,
and reset_ctx() from the previous step will clean up all contained
subtransforms.
This commit is contained in:
Lynne 2022-01-29 01:02:37 +01:00
parent 265731f201
commit 7e35e0224c
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
1 changed files with 2 additions and 1 deletions

View File

@ -606,7 +606,8 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
break;
}
av_freep(&s->sub);
if (!s->nb_sub)
av_freep(&s->sub);
end:
av_free(cd_matches);