[FFmpeg-devel] [PATCH] avcodec/libx264: Use av_memdup() where appropriate

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sun Nov 7 13:33:56 EET 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
Will apply tonight unless there are objections.

 libavcodec/libx264.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 0766b4a950..29546ebf06 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -985,10 +985,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
             if (nal[i].i_type == NAL_SEI) {
                 av_log(avctx, AV_LOG_INFO, "%s\n", nal[i].p_payload+25);
                 x4->sei_size = nal[i].i_payload;
-                x4->sei      = av_malloc(x4->sei_size);
+                x4->sei      = av_memdup(nal[i].p_payload, x4->sei_size);
                 if (!x4->sei)
                     return AVERROR(ENOMEM);
-                memcpy(x4->sei, nal[i].p_payload, nal[i].i_payload);
                 continue;
             }
             memcpy(p, nal[i].p_payload, nal[i].i_payload);
-- 
2.30.2



More information about the ffmpeg-devel mailing list