diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2008-10-11 22:11:18 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2008-10-11 22:11:18 +0000 |
commit | 79d8465f5e1fe0a287e8f10abd573ed184efe448 (patch) | |
tree | 695e75fb4edb0b702744c87210bb9574f63725d2 | |
parent | f2b127d27bcf6c9bacf1b16b371bdee30f7812d6 (diff) | |
download | netpbm-mirror-79d8465f5e1fe0a287e8f10abd573ed184efe448.tar.gz netpbm-mirror-79d8465f5e1fe0a287e8f10abd573ed184efe448.tar.xz netpbm-mirror-79d8465f5e1fe0a287e8f10abd573ed184efe448.zip |
Free if realloc fails
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@744 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | lib/util/mallocvar.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/util/mallocvar.h b/lib/util/mallocvar.h index b750e177..1f2be127 100644 --- a/lib/util/mallocvar.h +++ b/lib/util/mallocvar.h @@ -87,6 +87,8 @@ reallocProduct(void ** const blockP, void * array; \ array = arrayName; \ reallocProduct(&array, nElements, sizeof(arrayName[0])); \ + if (!array) \ + free(arrayName); \ arrayName = array; \ } while (0) |