projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
x86cpuid.pl: don't punish "last-year" OSes on "this-year" CPUs.
[openssl.git]
/
crypto
/
mem.c
diff --git
a/crypto/mem.c
b/crypto/mem.c
index 43d48ab425707d2d08c289e47f597fc32e9bb955..73d68b5f0bf84e423b705916d8740c46f4fc8bc2 100644
(file)
--- a/
crypto/mem.c
+++ b/
crypto/mem.c
@@
-101,7
+101,7
@@
static void (*free_locked_func)(void *) = free;
/* may be changed as long as 'allow_customize_debug' is set */
/* XXX use correct function pointer types */
/* may be changed as long as 'allow_customize_debug' is set */
/* XXX use correct function pointer types */
-#if
def CRYPTO_MDEBUG
+#if
defined(CRYPTO_MDEBUG)
/* use default functions from mem_dbg.c */
static void (*malloc_debug_func)(void *,int,const char *,int,int)
= CRYPTO_dbg_malloc;
/* use default functions from mem_dbg.c */
static void (*malloc_debug_func)(void *,int,const char *,int,int)
= CRYPTO_dbg_malloc;
@@
-121,10
+121,13
@@
static void (*set_debug_options_func)(long) = NULL;
static long (*get_debug_options_func)(void) = NULL;
#endif
static long (*get_debug_options_func)(void) = NULL;
#endif
+extern void OPENSSL_init(void);
int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t),
void (*f)(void *))
{
int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t),
void (*f)(void *))
{
+ /* Dummy call just to ensure OPENSSL_init() gets linked in */
+ OPENSSL_init();
if (!allow_customize)
return 0;
if ((m == 0) || (r == 0) || (f == 0))
if (!allow_customize)
return 0;
if ((m == 0) || (r == 0) || (f == 0))
@@
-322,6
+325,13
@@
void *CRYPTO_malloc(int num, const char *file, int line)
return ret;
}
return ret;
}
+char *CRYPTO_strdup(const char *str, const char *file, int line)
+ {
+ char *ret = CRYPTO_malloc(strlen(str)+1, file, line);
+
+ strcpy(ret, str);
+ return ret;
+ }
void *CRYPTO_realloc(void *str, int num, const char *file, int line)
{
void *CRYPTO_realloc(void *str, int num, const char *file, int line)
{