From 842745fe1705a6e7504aadd60c0d415ae35fe651 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 1 Nov 2014 10:51:08 +0100 Subject: [PATCH] avcodec/pthread_frame: Simplify code by using av_reallocp_array() Signed-off-by: Michael Niedermayer --- libavcodec/pthread_frame.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index e4f92d9dfd..fa1c50a982 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -286,13 +286,10 @@ FF_ENABLE_DEPRECATION_WARNINGS if (src->slice_count && src->slice_offset) { if (dst->slice_count < src->slice_count) { - int *tmp = av_realloc(dst->slice_offset, src->slice_count * - sizeof(*dst->slice_offset)); - if (!tmp) { - av_free(dst->slice_offset); - return AVERROR(ENOMEM); - } - dst->slice_offset = tmp; + int err = av_reallocp_array(&dst->slice_offset, src->slice_count, + sizeof(*dst->slice_offset)); + if (err < 0) + return err; } memcpy(dst->slice_offset, src->slice_offset, src->slice_count * sizeof(*dst->slice_offset));