summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/mem.c')
-rw-r--r--src/lib/libcrypto/mem.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c
index 21c0011380..9ecb8d26b1 100644
--- a/src/lib/libcrypto/mem.c
+++ b/src/lib/libcrypto/mem.c
@@ -125,7 +125,6 @@ static long (*get_debug_options_func)(void) = NULL;
125int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), 125int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t),
126 void (*f)(void *)) 126 void (*f)(void *))
127 { 127 {
128 OPENSSL_init();
129 if (!allow_customize) 128 if (!allow_customize)
130 return 0; 129 return 0;
131 if ((m == 0) || (r == 0) || (f == 0)) 130 if ((m == 0) || (r == 0) || (f == 0))
@@ -187,7 +186,6 @@ int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
187 { 186 {
188 if (!allow_customize_debug) 187 if (!allow_customize_debug)
189 return 0; 188 return 0;
190 OPENSSL_init();
191 malloc_debug_func=m; 189 malloc_debug_func=m;
192 realloc_debug_func=r; 190 realloc_debug_func=r;
193 free_debug_func=f; 191 free_debug_func=f;
@@ -326,9 +324,10 @@ void *CRYPTO_malloc(int num, const char *file, int line)
326 } 324 }
327char *CRYPTO_strdup(const char *str, const char *file, int line) 325char *CRYPTO_strdup(const char *str, const char *file, int line)
328 { 326 {
329 char *ret = CRYPTO_malloc(strlen(str)+1, file, line); 327 size_t len = strlen(str)+1;
328 char *ret = CRYPTO_malloc(len, file, line);
330 329
331 strcpy(ret, str); 330 memcpy(ret, str, len);
332 return ret; 331 return ret;
333 } 332 }
334 333