Browse Source

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>
tags/n2.1
Martin Storsjö 12 years ago
parent
commit
67e285ceca
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      libavutil/mem.c

+ 4
- 0
libavutil/mem.c View File

@@ -141,6 +141,10 @@ int av_reallocp(void *ptr, size_t size)
void **ptrptr = ptr; void **ptrptr = ptr;
void *ret; void *ret;


if (!size) {
av_freep(ptr);
return 0;
}
ret = av_realloc(*ptrptr, size); ret = av_realloc(*ptrptr, size);


if (!ret) { if (!ret) {


Loading…
Cancel
Save