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

Michael Niedermayer git at videolan.org
Fri Aug 9 14:22:34 CEST 2013


ffmpeg | branch: release/2.0 | Michael Niedermayer <michaelni at gmx.at> | Fri Aug  9 13:37:18 2013 +0200| [211374e52a933a2b3f21a4d6e66e9f1b0623e44e] | 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>
(cherry picked from commit c94f9e854228e0ea00e1de8769d8d3f7cab84a55)

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

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

 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