diff options
author | tedu <> | 2014-04-23 21:49:49 +0000 |
---|---|---|
committer | tedu <> | 2014-04-23 21:49:49 +0000 |
commit | 44049d9bd9b59e088c8484e489da02690dec681e (patch) | |
tree | 04038b1c2db47f604a9d2932db5a3930210f22e3 | |
parent | a327e8af9f36e199e426e8ff7ca024ec29e3c750 (diff) | |
download | openbsd-44049d9bd9b59e088c8484e489da02690dec681e.tar.gz openbsd-44049d9bd9b59e088c8484e489da02690dec681e.tar.bz2 openbsd-44049d9bd9b59e088c8484e489da02690dec681e.zip |
malloc/memset -> calloc. from peter malone
-rw-r--r-- | src/lib/libcrypto/dso/dso_lib.c | 3 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/dso/dso_lib.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/src/lib/libcrypto/dso/dso_lib.c b/src/lib/libcrypto/dso/dso_lib.c index 1ee4e45dce..ae10104560 100644 --- a/src/lib/libcrypto/dso/dso_lib.c +++ b/src/lib/libcrypto/dso/dso_lib.c | |||
@@ -107,12 +107,11 @@ DSO_new_method(DSO_METHOD *meth) | |||
107 | * to stealing the "best available" method. Will fallback | 107 | * to stealing the "best available" method. Will fallback |
108 | * to DSO_METH_null() in the worst case. */ | 108 | * to DSO_METH_null() in the worst case. */ |
109 | default_DSO_meth = DSO_METHOD_openssl(); | 109 | default_DSO_meth = DSO_METHOD_openssl(); |
110 | ret = (DSO *)malloc(sizeof(DSO)); | 110 | ret = calloc(1, sizeof(DSO)); |
111 | if (ret == NULL) { | 111 | if (ret == NULL) { |
112 | DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); | 112 | DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); |
113 | return (NULL); | 113 | return (NULL); |
114 | } | 114 | } |
115 | memset(ret, 0, sizeof(DSO)); | ||
116 | ret->meth_data = sk_void_new_null(); | 115 | ret->meth_data = sk_void_new_null(); |
117 | if (ret->meth_data == NULL) { | 116 | if (ret->meth_data == NULL) { |
118 | /* sk_new doesn't generate any errors so we do */ | 117 | /* sk_new doesn't generate any errors so we do */ |
diff --git a/src/lib/libssl/src/crypto/dso/dso_lib.c b/src/lib/libssl/src/crypto/dso/dso_lib.c index 1ee4e45dce..ae10104560 100644 --- a/src/lib/libssl/src/crypto/dso/dso_lib.c +++ b/src/lib/libssl/src/crypto/dso/dso_lib.c | |||
@@ -107,12 +107,11 @@ DSO_new_method(DSO_METHOD *meth) | |||
107 | * to stealing the "best available" method. Will fallback | 107 | * to stealing the "best available" method. Will fallback |
108 | * to DSO_METH_null() in the worst case. */ | 108 | * to DSO_METH_null() in the worst case. */ |
109 | default_DSO_meth = DSO_METHOD_openssl(); | 109 | default_DSO_meth = DSO_METHOD_openssl(); |
110 | ret = (DSO *)malloc(sizeof(DSO)); | 110 | ret = calloc(1, sizeof(DSO)); |
111 | if (ret == NULL) { | 111 | if (ret == NULL) { |
112 | DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); | 112 | DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); |
113 | return (NULL); | 113 | return (NULL); |
114 | } | 114 | } |
115 | memset(ret, 0, sizeof(DSO)); | ||
116 | ret->meth_data = sk_void_new_null(); | 115 | ret->meth_data = sk_void_new_null(); |
117 | if (ret->meth_data == NULL) { | 116 | if (ret->meth_data == NULL) { |
118 | /* sk_new doesn't generate any errors so we do */ | 117 | /* sk_new doesn't generate any errors so we do */ |