diff options
author | Martin Storsjö <martin@martin.st> | 2013-09-20 14:02:41 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-09-20 21:23:08 +0300 |
commit | 67e285ceca1cb602a5ab87010b30d904527924fe (patch) | |
tree | 7a350752c5121d4d30581a60619238e3eaf15f56 /libavutil/mem.c | |
parent | 1cad7171dd6896b59c7e102f8ca0c1f1066c515a (diff) | |
download | ffmpeg-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/mem.c')
-rw-r--r-- | libavutil/mem.c | 4 |
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) { |