[FFmpeg-cvslog] avcodec/utils: Assert that the pointer is set when size is in ff_fast_malloc()

Michael Niedermayer git at videolan.org
Sat Jul 11 23:44:40 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Jul 11 23:35:16 2015 +0200| [f8db81074a9674e3b0c7e71cca0aa90755b7f8fc] | committer: Michael Niedermayer

avcodec/utils: Assert that the pointer is set when size is in ff_fast_malloc()

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/utils.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b086665..fb5a72f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -127,8 +127,10 @@ static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size,
     void *val;
 
     memcpy(&val, ptr, sizeof(val));
-    if (min_size <= *size && val)
+    if (min_size <= *size) {
+        av_assert0(val || !min_size);
         return 0;
+    }
     min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
     av_freep(ptr);
     val = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size);



More information about the ffmpeg-cvslog mailing list