From 44049d9bd9b59e088c8484e489da02690dec681e Mon Sep 17 00:00:00 2001 From: tedu <> Date: Wed, 23 Apr 2014 21:49:49 +0000 Subject: malloc/memset -> calloc. from peter malone --- src/lib/libcrypto/dso/dso_lib.c | 3 +-- 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) * to stealing the "best available" method. Will fallback * to DSO_METH_null() in the worst case. */ default_DSO_meth = DSO_METHOD_openssl(); - ret = (DSO *)malloc(sizeof(DSO)); + ret = calloc(1, sizeof(DSO)); if (ret == NULL) { DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); return (NULL); } - memset(ret, 0, sizeof(DSO)); ret->meth_data = sk_void_new_null(); if (ret->meth_data == NULL) { /* 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) * to stealing the "best available" method. Will fallback * to DSO_METH_null() in the worst case. */ default_DSO_meth = DSO_METHOD_openssl(); - ret = (DSO *)malloc(sizeof(DSO)); + ret = calloc(1, sizeof(DSO)); if (ret == NULL) { DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); return (NULL); } - memset(ret, 0, sizeof(DSO)); ret->meth_data = sk_void_new_null(); if (ret->meth_data == NULL) { /* sk_new doesn't generate any errors so we do */ -- cgit v1.2.3-55-g6feb