Mercurial > libavcodec.hg
changeset 2147:f980082baeaa libavcodec
realloc(NULL) fix
author | michael |
---|---|
date | Tue, 27 Jul 2004 11:09:41 +0000 |
parents | b288cdc2ad68 |
children | 678be5a8f282 |
files | mem.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mem.c Tue Jul 27 09:44:57 2004 +0000 +++ b/mem.c Tue Jul 27 11:09:41 2004 +0000 @@ -95,7 +95,9 @@ { #ifdef MEMALIGN_HACK //FIXME this isnt aligned correctly though it probably isnt needed - int diff= ptr ? ((char*)ptr)[-1] : 0; + int diff; + if(!ptr) return av_malloc(size); + diff= ((char*)ptr)[-1]; return realloc(ptr - diff, size + diff) + diff; #else return realloc(ptr, size);