diff options
author | Niels Möller <nisse@lysator.liu.se> | 2003-02-11 09:44:19 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2003-02-11 09:44:19 +0100 |
commit | 27889a95d9c49a8121ebc896efc650db86402444 (patch) | |
tree | ed71eae4e36d40c7b2dc37feac9c00e5361af685 /realloc.c | |
parent | 766de8e43d35b574e20695d85915d18fca3db29d (diff) | |
download | nettle-27889a95d9c49a8121ebc896efc650db86402444.tar.gz |
(nettle_xrealloc): Fixed out-of-memory check.
Rev: src/nettle/realloc.c:1.2
Diffstat (limited to 'realloc.c')
-rw-r--r-- | realloc.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -41,9 +41,10 @@ void * nettle_xrealloc(void *ctx UNUSED, void *p, unsigned length) { void *n = realloc(p, length); - if (n) - return n; - - fprintf(stderr, "Virtual memory exhausted.\n"); - abort(); + if (length && !n) + { + fprintf(stderr, "Virtual memory exhausted.\n"); + abort(); + } + return n; } |