void *CRYPTO_malloc(size_t num, const char *file, int line) { void *ret = NULL; if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) return malloc_impl(num, file, line); if (num <= 0) return NULL; allow_customize = 0; #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_malloc(NULL, num, 0, file, line); ret = malloc(num); CRYPTO_mem_debug_malloc(ret, num, 1, file, line); } else { ret = malloc(num); } #else osslargused(file); osslargused(line); ret = malloc(num); #endif return ret; }
void *CRYPTO_malloc(size_t num, const char *file, int line) { void *ret = NULL; INCREMENT(malloc_count); if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) return malloc_impl(num, file, line); if (num == 0) return NULL; FAILTEST(); allow_customize = 0; #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_malloc(NULL, num, 0, file, line); ret = malloc(num); CRYPTO_mem_debug_malloc(ret, num, 1, file, line); } else { ret = malloc(num); } #else (void)(file); (void)(line); ret = malloc(num); #endif return ret; }
void *CRYPTO_malloc(size_t num, const char *file, int line) { void *ret = NULL; if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) return malloc_impl(num, file, line); if (num <= 0) return NULL; allow_customize = 0; #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_malloc(NULL, num, 0, file, line); ret = malloc(num); CRYPTO_mem_debug_malloc(ret, num, 1, file, line); } else { ret = malloc(num); } #else (void)file; (void)line; ret = malloc(num); #endif #ifndef OPENSSL_CPUID_OBJ /* * Create a dependency on the value of 'cleanse_ctr' so our memory * sanitisation function can't be optimised out. NB: We only do this for * >2Kb so the overhead doesn't bother us. */ if (ret && (num > 2048)) { extern unsigned char cleanse_ctr; ((unsigned char *)ret)[0] = cleanse_ctr; } #endif return ret; }