From 05c7b1631b4f6884b9ef5f0943a3d16d36383f52 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 17 Feb 2016 02:24:25 +0100 Subject: Implement the use of heap manipulator implementions - Make use of the functions given through CRYPTO_set_mem_functions(). - CRYPTO_free(), CRYPTO_clear_free() and CRYPTO_secure_free() now receive __FILE__ and __LINE__. - The API for CRYPTO_set_mem_functions() and CRYPTO_get_mem_functions() is slightly changed, the implementation for free() now takes a couple of extra arguments, taking __FILE__ and __LINE__. - The CRYPTO_ memory functions will *always* receive __FILE__ and __LINE__ from the corresponding OPENSSL_ macros, regardless of if crypto-mdebug has been enabled or not. The reason is that if someone swaps out the malloc(), realloc() and free() implementations, we can't know if they will use them or not. Reviewed-by: Rich Salz --- crypto/mem_sec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crypto/mem_sec.c') diff --git a/crypto/mem_sec.c b/crypto/mem_sec.c index 196c2457ad..be3bb9a62b 100644 --- a/crypto/mem_sec.c +++ b/crypto/mem_sec.c @@ -120,7 +120,7 @@ void *CRYPTO_secure_zalloc(size_t num, const char *file, int line) return ret; } -void CRYPTO_secure_free(void *ptr) +void CRYPTO_secure_free(void *ptr, const char *file, int line) { #ifdef IMPLEMENTED size_t actual_size; @@ -128,7 +128,7 @@ void CRYPTO_secure_free(void *ptr) if (ptr == NULL) return; if (!secure_mem_initialized) { - CRYPTO_free(ptr); + CRYPTO_free(ptr, file, line); return; } LOCK(); -- cgit v1.2.3