From a4798a5d5109cd9c1b5682efe19660e825da97e6 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sat, 27 Nov 2021 10:50:47 +0100 Subject: all: Use av_memdup() where appropriate Reviewed-by: Nicolas George Signed-off-by: Andreas Rheinhardt --- libavcodec/decode.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'libavcodec/decode.c') diff --git a/libavcodec/decode.c b/libavcodec/decode.c index c44724d150..52bf5dcd33 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1104,12 +1104,10 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) avctx->sw_pix_fmt = fmt[n - 1]; } - choices = av_malloc_array(n + 1, sizeof(*choices)); + choices = av_memdup(fmt, (n + 1) * sizeof(*choices)); if (!choices) return AV_PIX_FMT_NONE; - memcpy(choices, fmt, (n + 1) * sizeof(*choices)); - for (;;) { // Remove the previous hwaccel, if there was one. hwaccel_uninit(avctx); -- cgit v1.2.1