X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fex_data.c;h=20a2dd732447ad6c2cac5b9c4748cc976bad3f3d;hp=d55985ba0aed6d5a6baacd5a06f68018a5a4a3a4;hb=1c7b2c0ed5d02d0d60179e0df0c49ef3f659fa77;hpb=9c7a780bbebc1b6d87dc38a6aa3339033911a8bb diff --git a/crypto/ex_data.c b/crypto/ex_data.c index d55985ba0a..20a2dd7324 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -318,7 +318,7 @@ static EX_CLASS_ITEM *def_get_class(int class_index) CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA); p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d); if (!p) { - gen = OPENSSL_malloc(sizeof(EX_CLASS_ITEM)); + gen = OPENSSL_malloc(sizeof(*gen)); if (gen) { gen->class_index = class_index; gen->meth_num = 0; @@ -350,8 +350,7 @@ static int def_add_index(EX_CLASS_ITEM *item, long argl, void *argp, CRYPTO_EX_free *free_func) { int toret = -1; - CRYPTO_EX_DATA_FUNCS *a = - (CRYPTO_EX_DATA_FUNCS *)OPENSSL_malloc(sizeof(CRYPTO_EX_DATA_FUNCS)); + CRYPTO_EX_DATA_FUNCS *a = OPENSSL_malloc(sizeof(*a)); if (!a) { CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE); return -1; @@ -445,8 +444,7 @@ static int int_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) storage[i]->argl, storage[i]->argp); } } - if (storage) - OPENSSL_free(storage); + OPENSSL_free(storage); return 1; } @@ -488,8 +486,7 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, storage[i]->argl, storage[i]->argp); CRYPTO_set_ex_data(to, i, ptr); } - if (storage) - OPENSSL_free(storage); + OPENSSL_free(storage); return 1; } @@ -526,12 +523,9 @@ static void int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) storage[i]->argl, storage[i]->argp); } } - if (storage) - OPENSSL_free(storage); - if (ad->sk) { - sk_void_free(ad->sk); - ad->sk = NULL; - } + OPENSSL_free(storage); + sk_void_free(ad->sk); + ad->sk = NULL; } /********************************************************************/