move Curl_safefree() definition to curl_setup.h

This commit is contained in:
Viktor Szakats 2025-07-05 17:58:15 +02:00
parent 1c55ac1c17
commit 71164747ce
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 8 additions and 14 deletions

View file

@ -981,6 +981,14 @@ extern curl_realloc_callback Curl_crealloc;
extern curl_strdup_callback Curl_cstrdup;
extern curl_calloc_callback Curl_ccalloc;
/*
* Curl_safefree defined as a macro to allow MemoryTracking feature
* to log free() calls at same location where Curl_safefree is used.
* This macro also assigns NULL to given pointer when free'd.
*/
#define Curl_safefree(ptr) \
do { free((ptr)); (ptr) = NULL;} while(0)
#ifdef CURLDEBUG
#define CURL_GETADDRINFO(host,serv,hint,res) \
curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__)

View file

@ -186,18 +186,4 @@ CURL_EXTERN ALLOC_FUNC
#define fake_sclose(x) Curl_nop_stmt
#endif /* CURLDEBUG */
/*
** Following section applies even when CURLDEBUG is not defined.
*/
/*
* Curl_safefree defined as a macro to allow MemoryTracking feature
* to log free() calls at same location where Curl_safefree is used.
* This macro also assigns NULL to given pointer when free'd.
*/
#define Curl_safefree(ptr) \
do { free((ptr)); (ptr) = NULL;} while(0)
#endif /* HEADER_CURL_MEMDEBUG_H */