[FFmpeg-cvslog] avcodec/pthread_frame: Simplify code by using av_reallocp_array()

Michael Niedermayer git at videolan.org
Sat Nov 1 11:37:54 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Nov  1 10:51:08 2014 +0100| [842745fe1705a6e7504aadd60c0d415ae35fe651] | committer: Michael Niedermayer

avcodec/pthread_frame: Simplify code by using av_reallocp_array()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=842745fe1705a6e7504aadd60c0d415ae35fe651
---

 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 e4f92d9..fa1c50a 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));



More information about the ffmpeg-cvslog mailing list