Previously this did a double free (and returned an error).

Reported-by: Justin Ruggles
---
 libavutil/mem.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 172180e..b84020c 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -141,6 +141,10 @@ int av_reallocp(void *ptr, size_t size)
     void **ptrptr = ptr;
     void *ret;
 
+    if (!size) {
+        av_freep(ptr);
+        return 0;
+    }
     ret = av_realloc(*ptrptr, size);
 
     if (!ret) {
-- 
1.7.9.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to