提交 673692b8 编写于 作者: F FdaSilvaYY 提交者: Tomas Mraz

Coverity: fix two minor NPD issues.

Found by Coverity.
Reviewed-by: NMatt Caswell <matt@openssl.org>
Reviewed-by: NTim Hudson <tjh@openssl.org>
Reviewed-by: NPaul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8274)

(cherry picked from commit 23dc8feba817560485da00d690d7b7b9e5b15682)
上级 c3074077
...@@ -356,8 +356,10 @@ OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void) ...@@ -356,8 +356,10 @@ OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void)
{ {
OPENSSL_INIT_SETTINGS *ret = malloc(sizeof(*ret)); OPENSSL_INIT_SETTINGS *ret = malloc(sizeof(*ret));
if (ret != NULL) if (ret == NULL)
memset(ret, 0, sizeof(*ret)); return NULL;
memset(ret, 0, sizeof(*ret));
ret->flags = DEFAULT_CONF_MFLAGS; ret->flags = DEFAULT_CONF_MFLAGS;
return ret; return ret;
......
...@@ -235,7 +235,7 @@ int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) ...@@ -235,7 +235,7 @@ int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
return 0; return 0;
} }
for (i = 0; i < mx; i++) { for (i = 0; i < mx; i++) {
if (storage[i] && storage[i]->new_func) { if (storage[i] != NULL && storage[i]->new_func != NULL) {
ptr = CRYPTO_get_ex_data(ad, i); ptr = CRYPTO_get_ex_data(ad, i);
storage[i]->new_func(obj, ptr, ad, i, storage[i]->new_func(obj, ptr, ad, i,
storage[i]->argl, storage[i]->argp); storage[i]->argl, storage[i]->argp);
...@@ -299,7 +299,7 @@ int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, ...@@ -299,7 +299,7 @@ int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
for (i = 0; i < mx; i++) { for (i = 0; i < mx; i++) {
ptr = CRYPTO_get_ex_data(from, i); ptr = CRYPTO_get_ex_data(from, i);
if (storage[i] && storage[i]->dup_func) if (storage[i] != NULL && storage[i]->dup_func != NULL)
if (!storage[i]->dup_func(to, from, &ptr, i, if (!storage[i]->dup_func(to, from, &ptr, i,
storage[i]->argl, storage[i]->argp)) storage[i]->argl, storage[i]->argp))
goto err; goto err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册