comparison dbmalloc.h @ 1569:c42e8ff42bd1

Only use malloc wrapper if fuzzing
author Matt Johnston <matt@ucc.asn.au>
date Thu, 01 Mar 2018 23:46:24 +0800
parents 7209a6e30932
children d4efb7801fcd
comparison
equal deleted inserted replaced
1568:119a459b00d0 1569:c42e8ff42bd1
5 5
6 void * m_malloc(size_t size); 6 void * m_malloc(size_t size);
7 void * m_calloc(size_t nmemb, size_t size); 7 void * m_calloc(size_t nmemb, size_t size);
8 void * m_strdup(const char * str); 8 void * m_strdup(const char * str);
9 void * m_realloc(void* ptr, size_t size); 9 void * m_realloc(void* ptr, size_t size);
10
11 #if DROPBEAR_TRACKING_MALLOC
10 void m_free_direct(void* ptr); 12 void m_free_direct(void* ptr);
11 #define m_free(X) do {m_free_direct(X); (X) = NULL;} while (0) 13 #define m_free(X) do {m_free_direct(X); (X) = NULL;} while (0)
12
13 void m_malloc_set_epoch(unsigned int epoch); 14 void m_malloc_set_epoch(unsigned int epoch);
14 void m_malloc_free_epoch(unsigned int epoch, int dofree); 15 void m_malloc_free_epoch(unsigned int epoch, int dofree);
15 16
17 #else
18 /* plain wrapper */
19
20 #define m_free(X) do {free(X); (X) = NULL;} while (0)
21
22 #endif
23
24
16 #endif /* DBMALLOC_H_ */ 25 #endif /* DBMALLOC_H_ */