mem-cleanup, cont'd.
[openssl.git] / crypto / mem.c
index 8b9c8c38051b9b95530c1e4a17bb9ed68efd0379..a1a75a2ddc308244784f77120eb8aca65d1b7f3e 100644 (file)
@@ -291,9 +291,6 @@ void *CRYPTO_malloc(int num, const char *file, int line)
         malloc_debug_func(NULL, num, file, line, 0);
     }
     ret = malloc_ex_func(num, file, line);
-#ifdef LEVITTE_DEBUG_MEM
-    fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
-#endif
     if (malloc_debug_func != NULL)
         malloc_debug_func(ret, num, file, line, 1);
 
@@ -312,14 +309,12 @@ void *CRYPTO_malloc(int num, const char *file, int line)
     return ret;
 }
 
-char *CRYPTO_strdup(const char *str, const char *file, int line)
+void *CRYPTO_zalloc(int num, const char *file, int line)
 {
-    char *ret = CRYPTO_malloc(strlen(str) + 1, file, line);
-
-    if (ret == NULL)
-        return NULL;
+    void *ret = CRYPTO_malloc(num, file, line);
 
-    strcpy(ret, str);
+    if (ret != NULL)
+        memset(ret, 0, num);
     return ret;
 }
 
@@ -336,10 +331,6 @@ void *CRYPTO_realloc(void *str, int num, const char *file, int line)
     if (realloc_debug_func != NULL)
         realloc_debug_func(str, NULL, num, file, line, 0);
     ret = realloc_ex_func(str, num, file, line);
-#ifdef LEVITTE_DEBUG_MEM
-    fprintf(stderr, "LEVITTE_DEBUG_MEM:         | 0x%p -> 0x%p (%d)\n", str,
-            ret, num);
-#endif
     if (realloc_debug_func != NULL)
         realloc_debug_func(str, ret, num, file, line, 1);
 
@@ -371,11 +362,6 @@ void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file,
         memcpy(ret, str, old_len);
         OPENSSL_clear_free(str, old_len);
     }
-#ifdef LEVITTE_DEBUG_MEM
-    fprintf(stderr,
-            "LEVITTE_DEBUG_MEM:         | 0x%p -> 0x%p (%d)\n",
-            str, ret, num);
-#endif
     if (realloc_debug_func != NULL)
         realloc_debug_func(str, ret, num, file, line, 1);
 
@@ -386,9 +372,6 @@ void CRYPTO_free(void *str)
 {
     if (free_debug_func != NULL)
         free_debug_func(str, 0);
-#ifdef LEVITTE_DEBUG_MEM
-    fprintf(stderr, "LEVITTE_DEBUG_MEM:         < 0x%p\n", str);
-#endif
     free_func(str);
     if (free_debug_func != NULL)
         free_debug_func(NULL, 1);
@@ -403,13 +386,6 @@ void CRYPTO_clear_free(void *str, size_t num)
     CRYPTO_free(str);
 }
 
-void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
-{
-    OPENSSL_free(a);
-    a = OPENSSL_malloc(num);
-    return (a);
-}
-
 void CRYPTO_set_mem_debug_options(long bits)
 {
     if (set_debug_options_func != NULL)