diff mbox series

[FFmpeg-devel,09/10] avcodec/libdav1d: Use av_memdup() where appropriate

Message ID AM7PR03MB66605E90A9213F27B2792F7C8FB59@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,01/10] avcodec/binkaudio: Remove AV_CODEC_CAP_DELAY
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 11, 2021, 3:36 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/libdav1d.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 507aaa1a96..bbc81a9dc9 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -319,13 +319,13 @@  static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
             av_packet_unref(pkt);
 
             if (c->reordered_opaque != AV_NOPTS_VALUE) {
-                uint8_t *reordered_opaque = av_malloc(sizeof(c->reordered_opaque));
+                uint8_t *reordered_opaque = av_memdup(&c->reordered_opaque,
+                                                      sizeof(c->reordered_opaque));
                 if (!reordered_opaque) {
                     dav1d_data_unref(data);
                     return AVERROR(ENOMEM);
                 }
 
-                memcpy(reordered_opaque, &c->reordered_opaque, sizeof(c->reordered_opaque));
                 res = dav1d_data_wrap_user_data(data, reordered_opaque,
                                                 libdav1d_user_data_free, reordered_opaque);
                 if (res < 0) {