avcodec/pthread_frame: Simplify code by using av_reallocp_array()
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 1 Nov 2014 09:51:08 +0000 (10:51 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 1 Nov 2014 10:36:41 +0000 (11:36 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/pthread_frame.c

index e4f92d9..fa1c50a 100644 (file)
@@ -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));