diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-05-15 19:52:58 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-05-15 19:53:06 +0200 |
commit | b0c9eac44e7f4b1325c91108394c269b2c491fb7 (patch) | |
tree | 31d0a79cf4d0e5a9dde90f208e05b05112590082 | |
parent | 7dc8165b9b94b23cbb5bf23977d1cd7523ecb16e (diff) | |
download | gnunet-b0c9eac44e7f4b1325c91108394c269b2c491fb7.tar.gz gnunet-b0c9eac44e7f4b1325c91108394c269b2c491fb7.zip |
-add NULL check
-rw-r--r-- | src/util/common_allocation.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 215df55d4..308488131 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c | |||
@@ -327,8 +327,12 @@ GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber) | |||
327 | * @param linenumber where in the code was the call to GNUNET_free() | 327 | * @param linenumber where in the code was the call to GNUNET_free() |
328 | */ | 328 | */ |
329 | void | 329 | void |
330 | GNUNET_xfree_ (void *ptr, const char *filename, int linenumber) | 330 | GNUNET_xfree_ (void *ptr, |
331 | const char *filename, | ||
332 | int linenumber) | ||
331 | { | 333 | { |
334 | if (NULL == ptr) | ||
335 | return; | ||
332 | #ifdef W32_MEM_LIMIT | 336 | #ifdef W32_MEM_LIMIT |
333 | ptr = &((size_t *) ptr)[-1]; | 337 | ptr = &((size_t *) ptr)[-1]; |
334 | mem_used -= *((size_t *) ptr); | 338 | mem_used -= *((size_t *) ptr); |