[FFmpeg-cvslog] avutil/mem: Fix flipped condition

Michael Niedermayer git at videolan.org
Fri Aug 9 13:50:02 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Aug  9 13:37:18 2013 +0200| [c94f9e854228e0ea00e1de8769d8d3f7cab84a55] | committer: Michael Niedermayer

avutil/mem: Fix flipped condition

Fixes return code and later null pointer dereference

Found-by: Laurent Butti <laurentb at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavutil/mem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 76f6b65..20dfd62 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -191,7 +191,7 @@ int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
 {
     void **ptrptr = ptr;
     *ptrptr = av_realloc_f(*ptrptr, nmemb, size);
-    if (!*ptrptr && !(nmemb && size))
+    if (!*ptrptr && nmemb && size)
         return AVERROR(ENOMEM);
     return 0;
 }



More information about the ffmpeg-cvslog mailing list