aboutsummaryrefslogtreecommitdiff
path: root/lib/memdebug.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-05-22 13:58:17 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-05-22 13:59:29 +0200
commit8589e1fe30773e10c50b9a65d4f96eeb8434233c (patch)
treeabd3ef9c42c4c8a84f8071933e747e46d4da35b6 /lib/memdebug.c
parentfab9629133025e2d9517334535908200802b5e96 (diff)
assert: avoid, use DEBUGASSERT instead!
... as it does extra checks to actually work. Reported-by: jonrumsey at github Fixes #1504
Diffstat (limited to 'lib/memdebug.c')
-rw-r--r--lib/memdebug.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/memdebug.c b/lib/memdebug.c
index 516f273c1..3ee16c8eb 100644
--- a/lib/memdebug.c
+++ b/lib/memdebug.c
@@ -35,10 +35,6 @@
#include "curl_memory.h"
#include "memdebug.h"
-#ifndef HAVE_ASSERT_H
-# define assert(x) Curl_nop_stmt
-#endif
-
/*
* Until 2011-08-17 libcurl's Memory Tracking feature also performed
* automatic malloc and free filling operations using 0xA5 and 0x13
@@ -167,7 +163,7 @@ void *curl_domalloc(size_t wantedsize, int line, const char *source)
struct memdebug *mem;
size_t size;
- assert(wantedsize != 0);
+ DEBUGASSERT(wantedsize != 0);
if(countcheck("malloc", line, source))
return NULL;
@@ -196,8 +192,8 @@ void *curl_docalloc(size_t wanted_elements, size_t wanted_size,
struct memdebug *mem;
size_t size, user_size;
- assert(wanted_elements != 0);
- assert(wanted_size != 0);
+ DEBUGASSERT(wanted_elements != 0);
+ DEBUGASSERT(wanted_size != 0);
if(countcheck("calloc", line, source))
return NULL;
@@ -223,7 +219,7 @@ char *curl_dostrdup(const char *str, int line, const char *source)
char *mem;
size_t len;
- assert(str != NULL);
+ DEBUGASSERT(str != NULL);
if(countcheck("strdup", line, source))
return NULL;
@@ -247,7 +243,7 @@ wchar_t *curl_dowcsdup(const wchar_t *str, int line, const char *source)
wchar_t *mem;
size_t wsiz, bsiz;
- assert(str != NULL);
+ DEBUGASSERT(str != NULL);
if(countcheck("wcsdup", line, source))
return NULL;
@@ -276,7 +272,7 @@ void *curl_dorealloc(void *ptr, size_t wantedsize,
size_t size = sizeof(struct memdebug)+wantedsize;
- assert(wantedsize != 0);
+ DEBUGASSERT(wantedsize != 0);
if(countcheck("realloc", line, source))
return NULL;
@@ -445,7 +441,7 @@ int curl_fclose(FILE *file, int line, const char *source)
{
int res;
- assert(file != NULL);
+ DEBUGDEBUGASSERT(file != NULL);
res=fclose(file);