all: Use av_memdup() where appropriate

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2021-11-27 10:50:47 +01:00
parent b574fb472e
commit a4798a5d51
8 changed files with 11 additions and 25 deletions

View File

@@ -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);