diff options
author | miod <> | 2014-04-17 20:57:05 +0000 |
---|---|---|
committer | miod <> | 2014-04-17 20:57:05 +0000 |
commit | 6800e69ce3db198d08e1e509efdb706f4d2b4cf0 (patch) | |
tree | 23dbf43c1d89c1202f35d16ec5f3aac50c226750 /src/lib | |
parent | 2c5a5480e111e9bbee3ccc43d1827e5e7c5b18dc (diff) | |
download | openbsd-6800e69ce3db198d08e1e509efdb706f4d2b4cf0.tar.gz openbsd-6800e69ce3db198d08e1e509efdb706f4d2b4cf0.tar.bz2 openbsd-6800e69ce3db198d08e1e509efdb706f4d2b4cf0.zip |
malloc + memset 0 -> calloc
(not that it matters much as this is in disabled code, for we don't build with
zlib support)
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/comp/c_zlib.c | 24 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/comp/c_zlib.c | 24 |
2 files changed, 4 insertions, 44 deletions
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c index 2ced7c10cc..e50b6eb4a3 100644 --- a/src/lib/libcrypto/comp/c_zlib.c +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
@@ -35,15 +35,9 @@ static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out, | |||
35 | /* memory allocations functions for zlib intialization */ | 35 | /* memory allocations functions for zlib intialization */ |
36 | static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) | 36 | static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) |
37 | { | 37 | { |
38 | void *p; | 38 | return calloc(no, size); |
39 | |||
40 | p=malloc(no*size); | ||
41 | if (p) | ||
42 | memset(p, 0, no*size); | ||
43 | return p; | ||
44 | } | 39 | } |
45 | 40 | ||
46 | |||
47 | static void zlib_zfree(void* opaque, void* address) | 41 | static void zlib_zfree(void* opaque, void* address) |
48 | { | 42 | { |
49 | free(address); | 43 | free(address); |
@@ -81,16 +75,6 @@ static COMP_METHOD zlib_stateful_method={ | |||
81 | NULL, | 75 | NULL, |
82 | }; | 76 | }; |
83 | 77 | ||
84 | /* | ||
85 | * When OpenSSL is built on Windows, we do not want to require that | ||
86 | * the ZLIB.DLL be available in order for the OpenSSL DLLs to | ||
87 | * work. Therefore, all ZLIB routines are loaded at run time | ||
88 | * and we do not link to a .LIB file when ZLIB_SHARED is set. | ||
89 | */ | ||
90 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | ||
91 | # include <windows.h> | ||
92 | #endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */ | ||
93 | |||
94 | #ifdef ZLIB_SHARED | 78 | #ifdef ZLIB_SHARED |
95 | #include <openssl/dso.h> | 79 | #include <openssl/dso.h> |
96 | 80 | ||
@@ -173,7 +157,7 @@ static int zlib_stateful_init(COMP_CTX *ctx) | |||
173 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); | 157 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); |
174 | return 1; | 158 | return 1; |
175 | err: | 159 | err: |
176 | if (state) free(state); | 160 | free(state); |
177 | return 0; | 161 | return 0; |
178 | } | 162 | } |
179 | 163 | ||
@@ -345,11 +329,7 @@ COMP_METHOD *COMP_zlib(void) | |||
345 | #ifdef ZLIB_SHARED | 329 | #ifdef ZLIB_SHARED |
346 | if (!zlib_loaded) | 330 | if (!zlib_loaded) |
347 | { | 331 | { |
348 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | ||
349 | zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); | ||
350 | #else | ||
351 | zlib_dso = DSO_load(NULL, "z", NULL, 0); | 332 | zlib_dso = DSO_load(NULL, "z", NULL, 0); |
352 | #endif | ||
353 | if (zlib_dso != NULL) | 333 | if (zlib_dso != NULL) |
354 | { | 334 | { |
355 | p_compress | 335 | p_compress |
diff --git a/src/lib/libssl/src/crypto/comp/c_zlib.c b/src/lib/libssl/src/crypto/comp/c_zlib.c index 2ced7c10cc..e50b6eb4a3 100644 --- a/src/lib/libssl/src/crypto/comp/c_zlib.c +++ b/src/lib/libssl/src/crypto/comp/c_zlib.c | |||
@@ -35,15 +35,9 @@ static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out, | |||
35 | /* memory allocations functions for zlib intialization */ | 35 | /* memory allocations functions for zlib intialization */ |
36 | static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) | 36 | static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) |
37 | { | 37 | { |
38 | void *p; | 38 | return calloc(no, size); |
39 | |||
40 | p=malloc(no*size); | ||
41 | if (p) | ||
42 | memset(p, 0, no*size); | ||
43 | return p; | ||
44 | } | 39 | } |
45 | 40 | ||
46 | |||
47 | static void zlib_zfree(void* opaque, void* address) | 41 | static void zlib_zfree(void* opaque, void* address) |
48 | { | 42 | { |
49 | free(address); | 43 | free(address); |
@@ -81,16 +75,6 @@ static COMP_METHOD zlib_stateful_method={ | |||
81 | NULL, | 75 | NULL, |
82 | }; | 76 | }; |
83 | 77 | ||
84 | /* | ||
85 | * When OpenSSL is built on Windows, we do not want to require that | ||
86 | * the ZLIB.DLL be available in order for the OpenSSL DLLs to | ||
87 | * work. Therefore, all ZLIB routines are loaded at run time | ||
88 | * and we do not link to a .LIB file when ZLIB_SHARED is set. | ||
89 | */ | ||
90 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | ||
91 | # include <windows.h> | ||
92 | #endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */ | ||
93 | |||
94 | #ifdef ZLIB_SHARED | 78 | #ifdef ZLIB_SHARED |
95 | #include <openssl/dso.h> | 79 | #include <openssl/dso.h> |
96 | 80 | ||
@@ -173,7 +157,7 @@ static int zlib_stateful_init(COMP_CTX *ctx) | |||
173 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); | 157 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); |
174 | return 1; | 158 | return 1; |
175 | err: | 159 | err: |
176 | if (state) free(state); | 160 | free(state); |
177 | return 0; | 161 | return 0; |
178 | } | 162 | } |
179 | 163 | ||
@@ -345,11 +329,7 @@ COMP_METHOD *COMP_zlib(void) | |||
345 | #ifdef ZLIB_SHARED | 329 | #ifdef ZLIB_SHARED |
346 | if (!zlib_loaded) | 330 | if (!zlib_loaded) |
347 | { | 331 | { |
348 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | ||
349 | zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); | ||
350 | #else | ||
351 | zlib_dso = DSO_load(NULL, "z", NULL, 0); | 332 | zlib_dso = DSO_load(NULL, "z", NULL, 0); |
352 | #endif | ||
353 | if (zlib_dso != NULL) | 333 | if (zlib_dso != NULL) |
354 | { | 334 | { |
355 | p_compress | 335 | p_compress |