[FFmpeg-cvslog] lavu/tx: do not unconditionally free subcontexts if initialization fails

Lynne git at videolan.org
Sat Jan 29 02:12:12 EET 2022


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sat Jan 29 01:02:37 2022 +0100| [7e35e0224cb1e82bfefdedeff9db946a05363c83] | committer: Lynne

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e35e0224cb1e82bfefdedeff9db946a05363c83
---

 libavutil/tx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/tx.c b/libavutil/tx.c
index a90ccffcc4..573f4863d1 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -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);



More information about the ffmpeg-cvslog mailing list