[FFmpeg-cvslog] avformat/matroskaenc: fix memory leak in fail codepath

James Almer git at videolan.org
Tue Apr 11 04:14:33 EEST 2023


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Apr 10 22:12:13 2023 -0300| [1a7df525f6c2ea0287351dfad4580d57d23ff730] | committer: James Almer

avformat/matroskaenc: fix memory leak in fail codepath

Signed-off-by: James Almer <jamrial at gmail.com>

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

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

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 59ed5be951..492b86b8d7 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2715,7 +2715,7 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
         ret = av_dynamic_hdr_plus_to_t35((AVDynamicHDRPlus *)side_data, &payload,
                                          &payload_size);
         if (ret < 0)
-            return ret;
+            goto fail;
 
         mkv_write_blockadditional(&writer, buf, buf_size,
                                   MATROSKA_BLOCK_ADD_ID_ITU_T_T35);
@@ -2738,6 +2738,7 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
                              track->last_timestamp - ts);
 
     ret = ebml_writer_write(&writer, pb);
+fail:
     av_free(buf);
 
     return ret;



More information about the ffmpeg-cvslog mailing list