[FFmpeg-cvslog] avutil/mem: fix memleak

Zhao Zhili git at videolan.org
Thu Jul 28 13:14:05 EEST 2016


ffmpeg | branch: master | Zhao Zhili <wantlamy at gmail.com> | Tue Jul 19 00:30:54 2016 +0800| [65b2feb890db3c1eeb8069c5313aa3e2345766ed] | committer: Michael Niedermayer

avutil/mem: fix memleak

The original code assumes av_realloc() will free ptr if size is zero.
The assumes is incorrect now.

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

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

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

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 8dfaad8..809ec01 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -179,7 +179,7 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize)
         return NULL;
     }
     r = av_realloc(ptr, size);
-    if (!r && size)
+    if (!r)
         av_free(ptr);
     return r;
 }



More information about the ffmpeg-cvslog mailing list