From 90945fa31a42dcf3beb90540c618e4d627c595ea Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 30 Oct 2015 11:12:26 +0000 Subject: Continue standardising malloc style for libcrypto Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx --- crypto/objects/o_names.c | 4 ++-- crypto/objects/obj_xref.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'crypto/objects') diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index 7a24ad01f2..d7441cad82 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -85,7 +85,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), MemCheck_off(); name_funcs = OPENSSL_zalloc(sizeof(*name_funcs)); MemCheck_on(); - if (!name_funcs) { + if (name_funcs == NULL) { OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE); return (0); } @@ -308,7 +308,7 @@ void OBJ_NAME_do_all_sorted(int type, d.names = OPENSSL_malloc(sizeof(*d.names) * lh_OBJ_NAME_num_items(names_lh)); /* Really should return an error if !d.names...but its a void function! */ - if (d.names) { + if (d.names != NULL) { d.n = 0; OBJ_NAME_do_all(type, do_all_sorted_fn, &d); diff --git a/crypto/objects/obj_xref.c b/crypto/objects/obj_xref.c index da3469f0e8..6e35f5746f 100644 --- a/crypto/objects/obj_xref.c +++ b/crypto/objects/obj_xref.c @@ -147,16 +147,16 @@ int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) int OBJ_add_sigid(int signid, int dig_id, int pkey_id) { nid_triple *ntr; - if (!sig_app) + if (sig_app == NULL) sig_app = sk_nid_triple_new(sig_sk_cmp); - if (!sig_app) + if (sig_app == NULL) return 0; - if (!sigx_app) + if (sigx_app == NULL) sigx_app = sk_nid_triple_new(sigx_cmp); - if (!sigx_app) + if (sigx_app == NULL) return 0; ntr = OPENSSL_malloc(sizeof(*ntr)); - if (!ntr) + if (ntr == NULL) return 0; ntr->sign_id = signid; ntr->hash_id = dig_id; -- cgit v1.2.3