aboutsummaryrefslogtreecommitdiff
path: root/crypto/ex_data.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2019-04-06 19:16:59 +1000
committerPauli <paul.dale@oracle.com>2019-04-06 19:16:59 +1000
commit23dc8feba817560485da00d690d7b7b9e5b15682 (patch)
tree4475bcd58bd01f4667c8a5be1a2dc378631ecac8 /crypto/ex_data.c
parent6ce84e64102c9df984e3a00af12eb797c398563f (diff)
downloadopenssl-23dc8feba817560485da00d690d7b7b9e5b15682.zip
openssl-23dc8feba817560485da00d690d7b7b9e5b15682.tar.gz
openssl-23dc8feba817560485da00d690d7b7b9e5b15682.tar.bz2
Coverity: fix two minor NPD issues.
Found by Coverity. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8274)
Diffstat (limited to 'crypto/ex_data.c')
-rw-r--r--crypto/ex_data.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/ex_data.c b/crypto/ex_data.c
index a728bfb..5f83191 100644
--- a/crypto/ex_data.c
+++ b/crypto/ex_data.c
@@ -235,7 +235,7 @@ int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
return 0;
}
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);
storage[i]->new_func(obj, ptr, ad, i,
storage[i]->argl, storage[i]->argp);
@@ -299,7 +299,7 @@ int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
for (i = 0; i < mx; 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,
storage[i]->argl, storage[i]->argp))
goto err;
@@ -380,6 +380,8 @@ int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad,
return 1;
ip = get_and_lock(class_index);
+ if (ip == NULL)
+ return 0;
f = sk_EX_CALLBACK_value(ip->meth, idx);
CRYPTO_THREAD_unlock(ex_data_lock);
@@ -387,6 +389,9 @@ int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad,
* This should end up calling CRYPTO_set_ex_data(), which allocates
* everything necessary to support placing the new data in the right spot.
*/
+ if (f->new_func == NULL)
+ return 0;
+
f->new_func(obj, curval, ad, idx, f->argl, f->argp);
return 1;