aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-20 14:02:41 +0300
committerMartin Storsjö <martin@martin.st>2013-09-20 21:23:08 +0300
commit67e285ceca1cb602a5ab87010b30d904527924fe (patch)
tree7a350752c5121d4d30581a60619238e3eaf15f56 /libavutil
parent1cad7171dd6896b59c7e102f8ca0c1f1066c515a (diff)
downloadffmpeg-67e285ceca1cb602a5ab87010b30d904527924fe.tar.gz
mem: Handle av_reallocp(..., 0) properly
Previously this did a double free (and returned an error). Reported-by: Justin Ruggles Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/mem.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 172180e7b9..b84020c0f9 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) {