diff options
author | tedu <> | 2014-05-30 02:52:11 +0000 |
---|---|---|
committer | tedu <> | 2014-05-30 02:52:11 +0000 |
commit | 9598b4272312fc9b55154e675c1adb3a21b491b3 (patch) | |
tree | a802460259115af2ecf6be49736b1b6a09173232 | |
parent | 50df74c1961eaed1e88ea9c7bb4cfcab77d75043 (diff) | |
download | openbsd-9598b4272312fc9b55154e675c1adb3a21b491b3.tar.gz openbsd-9598b4272312fc9b55154e675c1adb3a21b491b3.tar.bz2 openbsd-9598b4272312fc9b55154e675c1adb3a21b491b3.zip |
no need for null check before free. from Brendan MacDonell
39 files changed, 57 insertions, 112 deletions
diff --git a/src/lib/libcrypto/asn1/ameth_lib.c b/src/lib/libcrypto/asn1/ameth_lib.c index 8652e938bd..771b4f9690 100644 --- a/src/lib/libcrypto/asn1/ameth_lib.c +++ b/src/lib/libcrypto/asn1/ameth_lib.c | |||
@@ -380,10 +380,8 @@ void | |||
380 | EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) | 380 | EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) |
381 | { | 381 | { |
382 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { | 382 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { |
383 | if (ameth->pem_str) | 383 | free(ameth->pem_str); |
384 | free(ameth->pem_str); | 384 | free(ameth->info); |
385 | if (ameth->info) | ||
386 | free(ameth->info); | ||
387 | free(ameth); | 385 | free(ameth); |
388 | } | 386 | } |
389 | } | 387 | } |
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index c2f0837a1c..b28cdc56cf 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
@@ -401,8 +401,7 @@ ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | |||
401 | void | 401 | void |
402 | ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) | 402 | ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) |
403 | { | 403 | { |
404 | if (str->data) | 404 | free(str->data); |
405 | free(str->data); | ||
406 | str->data = data; | 405 | str->data = data; |
407 | str->length = len; | 406 | str->length = len; |
408 | } | 407 | } |
diff --git a/src/lib/libcrypto/asn1/asn_mime.c b/src/lib/libcrypto/asn1/asn_mime.c index 5d70b76f05..f123a7ddc0 100644 --- a/src/lib/libcrypto/asn1/asn_mime.c +++ b/src/lib/libcrypto/asn1/asn_mime.c | |||
@@ -949,10 +949,8 @@ mime_param_find(MIME_HEADER *hdr, char *name) | |||
949 | static void | 949 | static void |
950 | mime_hdr_free(MIME_HEADER *hdr) | 950 | mime_hdr_free(MIME_HEADER *hdr) |
951 | { | 951 | { |
952 | if (hdr->name) | 952 | free(hdr->name); |
953 | free(hdr->name); | 953 | free(hdr->value); |
954 | if (hdr->value) | ||
955 | free(hdr->value); | ||
956 | if (hdr->params) | 954 | if (hdr->params) |
957 | sk_MIME_PARAM_pop_free(hdr->params, mime_param_free); | 955 | sk_MIME_PARAM_pop_free(hdr->params, mime_param_free); |
958 | free(hdr); | 956 | free(hdr); |
@@ -961,10 +959,8 @@ mime_hdr_free(MIME_HEADER *hdr) | |||
961 | static void | 959 | static void |
962 | mime_param_free(MIME_PARAM *param) | 960 | mime_param_free(MIME_PARAM *param) |
963 | { | 961 | { |
964 | if (param->param_name) | 962 | free(param->param_name); |
965 | free(param->param_name); | 963 | free(param->param_value); |
966 | if (param->param_value) | ||
967 | free(param->param_value); | ||
968 | free(param); | 964 | free(param); |
969 | } | 965 | } |
970 | 966 | ||
diff --git a/src/lib/libcrypto/asn1/bio_asn1.c b/src/lib/libcrypto/asn1/bio_asn1.c index 327355eeda..223461d933 100644 --- a/src/lib/libcrypto/asn1/bio_asn1.c +++ b/src/lib/libcrypto/asn1/bio_asn1.c | |||
@@ -186,8 +186,7 @@ asn1_bio_free(BIO *b) | |||
186 | ctx = (BIO_ASN1_BUF_CTX *) b->ptr; | 186 | ctx = (BIO_ASN1_BUF_CTX *) b->ptr; |
187 | if (ctx == NULL) | 187 | if (ctx == NULL) |
188 | return 0; | 188 | return 0; |
189 | if (ctx->buf) | 189 | free(ctx->buf); |
190 | free(ctx->buf); | ||
191 | free(ctx); | 190 | free(ctx); |
192 | b->init = 0; | 191 | b->init = 0; |
193 | b->ptr = NULL; | 192 | b->ptr = NULL; |
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c index 66be025127..f7fa2e69bc 100644 --- a/src/lib/libcrypto/asn1/bio_ndef.c +++ b/src/lib/libcrypto/asn1/bio_ndef.c | |||
@@ -186,8 +186,7 @@ ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
186 | 186 | ||
187 | ndef_aux = *(NDEF_SUPPORT **)parg; | 187 | ndef_aux = *(NDEF_SUPPORT **)parg; |
188 | 188 | ||
189 | if (ndef_aux->derbuf) | 189 | free(ndef_aux->derbuf); |
190 | free(ndef_aux->derbuf); | ||
191 | 190 | ||
192 | ndef_aux->derbuf = NULL; | 191 | ndef_aux->derbuf = NULL; |
193 | *pbuf = NULL; | 192 | *pbuf = NULL; |
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index c8b379f371..b524104d91 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
@@ -951,8 +951,7 @@ asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, | |||
951 | } | 951 | } |
952 | /* If we've already allocated a buffer use it */ | 952 | /* If we've already allocated a buffer use it */ |
953 | if (*free_cont) { | 953 | if (*free_cont) { |
954 | if (stmp->data) | 954 | free(stmp->data); |
955 | free(stmp->data); | ||
956 | stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */ | 955 | stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */ |
957 | stmp->length = len; | 956 | stmp->length = len; |
958 | *free_cont = 0; | 957 | *free_cont = 0; |
diff --git a/src/lib/libcrypto/asn1/tasn_utl.c b/src/lib/libcrypto/asn1/tasn_utl.c index e1051c2c3e..446a6f82bd 100644 --- a/src/lib/libcrypto/asn1/tasn_utl.c +++ b/src/lib/libcrypto/asn1/tasn_utl.c | |||
@@ -153,8 +153,7 @@ asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
153 | 153 | ||
154 | enc = asn1_get_enc_ptr(pval, it); | 154 | enc = asn1_get_enc_ptr(pval, it); |
155 | if (enc) { | 155 | if (enc) { |
156 | if (enc->enc) | 156 | free(enc->enc); |
157 | free(enc->enc); | ||
158 | enc->enc = NULL; | 157 | enc->enc = NULL; |
159 | enc->len = 0; | 158 | enc->len = 0; |
160 | enc->modified = 1; | 159 | enc->modified = 1; |
@@ -171,8 +170,7 @@ asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, | |||
171 | if (!enc) | 170 | if (!enc) |
172 | return 1; | 171 | return 1; |
173 | 172 | ||
174 | if (enc->enc) | 173 | free(enc->enc); |
175 | free(enc->enc); | ||
176 | enc->enc = malloc(inlen); | 174 | enc->enc = malloc(inlen); |
177 | if (!enc->enc) | 175 | if (!enc->enc) |
178 | return 0; | 176 | return 0; |
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index 70459babc4..366ff17976 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
@@ -164,8 +164,7 @@ x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
164 | 164 | ||
165 | BUF_MEM_free(a->bytes); | 165 | BUF_MEM_free(a->bytes); |
166 | sk_X509_NAME_ENTRY_pop_free(a->entries, X509_NAME_ENTRY_free); | 166 | sk_X509_NAME_ENTRY_pop_free(a->entries, X509_NAME_ENTRY_free); |
167 | if (a->canon_enc) | 167 | free(a->canon_enc); |
168 | free(a->canon_enc); | ||
169 | free(a); | 168 | free(a); |
170 | *pval = NULL; | 169 | *pval = NULL; |
171 | } | 170 | } |
diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index df915e2dfd..f8b22fc372 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c | |||
@@ -355,8 +355,7 @@ X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, int ptype, | |||
355 | if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval)) | 355 | if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval)) |
356 | return 0; | 356 | return 0; |
357 | if (penc) { | 357 | if (penc) { |
358 | if (pub->public_key->data) | 358 | free(pub->public_key->data); |
359 | free(pub->public_key->data); | ||
360 | pub->public_key->data = penc; | 359 | pub->public_key->data = penc; |
361 | pub->public_key->length = penclen; | 360 | pub->public_key->length = penclen; |
362 | /* Set number of unused bits to zero */ | 361 | /* Set number of unused bits to zero */ |
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c index b574104791..f7fdbfa670 100644 --- a/src/lib/libcrypto/conf/conf_mod.c +++ b/src/lib/libcrypto/conf/conf_mod.c | |||
@@ -386,10 +386,8 @@ err: | |||
386 | 386 | ||
387 | memerr: | 387 | memerr: |
388 | if (imod) { | 388 | if (imod) { |
389 | if (imod->name) | 389 | free(imod->name); |
390 | free(imod->name); | 390 | free(imod->value); |
391 | if (imod->value) | ||
392 | free(imod->value); | ||
393 | free(imod); | 391 | free(imod); |
394 | } | 392 | } |
395 | 393 | ||
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c index e09c5fdd21..7a680cc5b4 100644 --- a/src/lib/libcrypto/dh/dh_lib.c +++ b/src/lib/libcrypto/dh/dh_lib.c | |||
@@ -193,7 +193,7 @@ void DH_free(DH *r) | |||
193 | if (r->g != NULL) BN_clear_free(r->g); | 193 | if (r->g != NULL) BN_clear_free(r->g); |
194 | if (r->q != NULL) BN_clear_free(r->q); | 194 | if (r->q != NULL) BN_clear_free(r->q); |
195 | if (r->j != NULL) BN_clear_free(r->j); | 195 | if (r->j != NULL) BN_clear_free(r->j); |
196 | if (r->seed) free(r->seed); | 196 | free(r->seed); |
197 | if (r->counter != NULL) BN_clear_free(r->counter); | 197 | if (r->counter != NULL) BN_clear_free(r->counter); |
198 | if (r->pub_key != NULL) BN_clear_free(r->pub_key); | 198 | if (r->pub_key != NULL) BN_clear_free(r->pub_key); |
199 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); | 199 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); |
diff --git a/src/lib/libcrypto/dso/dso_lib.c b/src/lib/libcrypto/dso/dso_lib.c index 882b9c2fcb..3859be7b42 100644 --- a/src/lib/libcrypto/dso/dso_lib.c +++ b/src/lib/libcrypto/dso/dso_lib.c | |||
@@ -361,8 +361,7 @@ DSO_set_filename(DSO *dso, const char *filename) | |||
361 | DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE); | 361 | DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE); |
362 | return (0); | 362 | return (0); |
363 | } | 363 | } |
364 | if (dso->filename) | 364 | free(dso->filename); |
365 | free(dso->filename); | ||
366 | dso->filename = copied; | 365 | dso->filename = copied; |
367 | return (1); | 366 | return (1); |
368 | } | 367 | } |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index b37efac246..3313573a05 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -130,8 +130,7 @@ EC_GROUP_free(EC_GROUP * group) | |||
130 | BN_free(&group->order); | 130 | BN_free(&group->order); |
131 | BN_free(&group->cofactor); | 131 | BN_free(&group->cofactor); |
132 | 132 | ||
133 | if (group->seed) | 133 | free(group->seed); |
134 | free(group->seed); | ||
135 | 134 | ||
136 | free(group); | 135 | free(group); |
137 | } | 136 | } |
@@ -218,8 +217,7 @@ EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src) | |||
218 | dest->asn1_form = src->asn1_form; | 217 | dest->asn1_form = src->asn1_form; |
219 | 218 | ||
220 | if (src->seed) { | 219 | if (src->seed) { |
221 | if (dest->seed) | 220 | free(dest->seed); |
222 | free(dest->seed); | ||
223 | dest->seed = malloc(src->seed_len); | 221 | dest->seed = malloc(src->seed_len); |
224 | if (dest->seed == NULL) | 222 | if (dest->seed == NULL) |
225 | return 0; | 223 | return 0; |
@@ -227,8 +225,7 @@ EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src) | |||
227 | return 0; | 225 | return 0; |
228 | dest->seed_len = src->seed_len; | 226 | dest->seed_len = src->seed_len; |
229 | } else { | 227 | } else { |
230 | if (dest->seed) | 228 | free(dest->seed); |
231 | free(dest->seed); | ||
232 | dest->seed = NULL; | 229 | dest->seed = NULL; |
233 | dest->seed_len = 0; | 230 | dest->seed_len = 0; |
234 | } | 231 | } |
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 7d55045164..7da9913d28 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
@@ -926,8 +926,7 @@ zapparams(struct crypt_kop *kop) | |||
926 | int i; | 926 | int i; |
927 | 927 | ||
928 | for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) { | 928 | for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) { |
929 | if (kop->crk_param[i].crp_p) | 929 | free(kop->crk_param[i].crp_p); |
930 | free(kop->crk_param[i].crp_p); | ||
931 | kop->crk_param[i].crp_p = NULL; | 930 | kop->crk_param[i].crp_p = NULL; |
932 | kop->crk_param[i].crp_nbits = 0; | 931 | kop->crk_param[i].crp_nbits = 0; |
933 | } | 932 | } |
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index 0c3e8fcc39..afe34f6f3f 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
@@ -548,8 +548,7 @@ EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | |||
548 | if (c->cipher_data) | 548 | if (c->cipher_data) |
549 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); | 549 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); |
550 | } | 550 | } |
551 | if (c->cipher_data) | 551 | free(c->cipher_data); |
552 | free(c->cipher_data); | ||
553 | #ifndef OPENSSL_NO_ENGINE | 552 | #ifndef OPENSSL_NO_ENGINE |
554 | if (c->engine) | 553 | if (c->engine) |
555 | /* The EVP_CIPHER we used belongs to an ENGINE, release the | 554 | /* The EVP_CIPHER we used belongs to an ENGINE, release the |
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c index a42b4f03f4..894d51d532 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ht.c +++ b/src/lib/libcrypto/ocsp/ocsp_ht.c | |||
@@ -110,8 +110,7 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) | |||
110 | { | 110 | { |
111 | if (rctx->mem) | 111 | if (rctx->mem) |
112 | BIO_free(rctx->mem); | 112 | BIO_free(rctx->mem); |
113 | if (rctx->iobuf) | 113 | free(rctx->iobuf); |
114 | free(rctx->iobuf); | ||
115 | free(rctx); | 114 | free(rctx); |
116 | } | 115 | } |
117 | 116 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index 5580b7783a..e75596afa3 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c | |||
@@ -148,8 +148,7 @@ static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx) | |||
148 | { | 148 | { |
149 | if (rctx->pub_exp) | 149 | if (rctx->pub_exp) |
150 | BN_free(rctx->pub_exp); | 150 | BN_free(rctx->pub_exp); |
151 | if (rctx->tbuf) | 151 | free(rctx->tbuf); |
152 | free(rctx->tbuf); | ||
153 | free(rctx); | 152 | free(rctx); |
154 | } | 153 | } |
155 | } | 154 | } |
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c index fdfca6140a..554f6600dc 100644 --- a/src/lib/libcrypto/x509/by_dir.c +++ b/src/lib/libcrypto/x509/by_dir.c | |||
@@ -184,8 +184,7 @@ by_dir_hash_cmp(const BY_DIR_HASH * const *a, | |||
184 | static void | 184 | static void |
185 | by_dir_entry_free(BY_DIR_ENTRY *ent) | 185 | by_dir_entry_free(BY_DIR_ENTRY *ent) |
186 | { | 186 | { |
187 | if (ent->dir) | 187 | free(ent->dir); |
188 | free(ent->dir); | ||
189 | if (ent->hashes) | 188 | if (ent->hashes) |
190 | sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); | 189 | sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); |
191 | free(ent); | 190 | free(ent); |
diff --git a/src/lib/libcrypto/x509/x509_vpm.c b/src/lib/libcrypto/x509/x509_vpm.c index c2cebd936f..3ee3116ac1 100644 --- a/src/lib/libcrypto/x509/x509_vpm.c +++ b/src/lib/libcrypto/x509/x509_vpm.c | |||
@@ -212,8 +212,7 @@ X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, const X509_VERIFY_PARAM *from) | |||
212 | int | 212 | int |
213 | X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) | 213 | X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) |
214 | { | 214 | { |
215 | if (param->name) | 215 | free(param->name); |
216 | free(param->name); | ||
217 | param->name = BUF_strdup(name); | 216 | param->name = BUF_strdup(name); |
218 | if (param->name) | 217 | if (param->name) |
219 | return 1; | 218 | return 1; |
diff --git a/src/lib/libssl/src/apps/s_server.c b/src/lib/libssl/src/apps/s_server.c index be77264fb0..51f6b478b1 100644 --- a/src/lib/libssl/src/apps/s_server.c +++ b/src/lib/libssl/src/apps/s_server.c | |||
@@ -1460,12 +1460,9 @@ end: | |||
1460 | if (vpm) | 1460 | if (vpm) |
1461 | X509_VERIFY_PARAM_free(vpm); | 1461 | X509_VERIFY_PARAM_free(vpm); |
1462 | #ifndef OPENSSL_NO_TLSEXT | 1462 | #ifndef OPENSSL_NO_TLSEXT |
1463 | if (tlscstatp.host) | 1463 | free(tlscstatp.host); |
1464 | free(tlscstatp.host); | 1464 | free(tlscstatp.port); |
1465 | if (tlscstatp.port) | 1465 | free(tlscstatp.path); |
1466 | free(tlscstatp.port); | ||
1467 | if (tlscstatp.path) | ||
1468 | free(tlscstatp.path); | ||
1469 | if (ctx2 != NULL) | 1466 | if (ctx2 != NULL) |
1470 | SSL_CTX_free(ctx2); | 1467 | SSL_CTX_free(ctx2); |
1471 | if (s_cert2) | 1468 | if (s_cert2) |
diff --git a/src/lib/libssl/src/crypto/asn1/ameth_lib.c b/src/lib/libssl/src/crypto/asn1/ameth_lib.c index 8652e938bd..771b4f9690 100644 --- a/src/lib/libssl/src/crypto/asn1/ameth_lib.c +++ b/src/lib/libssl/src/crypto/asn1/ameth_lib.c | |||
@@ -380,10 +380,8 @@ void | |||
380 | EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) | 380 | EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) |
381 | { | 381 | { |
382 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { | 382 | if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { |
383 | if (ameth->pem_str) | 383 | free(ameth->pem_str); |
384 | free(ameth->pem_str); | 384 | free(ameth->info); |
385 | if (ameth->info) | ||
386 | free(ameth->info); | ||
387 | free(ameth); | 385 | free(ameth); |
388 | } | 386 | } |
389 | } | 387 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_lib.c b/src/lib/libssl/src/crypto/asn1/asn1_lib.c index c2f0837a1c..b28cdc56cf 100644 --- a/src/lib/libssl/src/crypto/asn1/asn1_lib.c +++ b/src/lib/libssl/src/crypto/asn1/asn1_lib.c | |||
@@ -401,8 +401,7 @@ ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | |||
401 | void | 401 | void |
402 | ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) | 402 | ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) |
403 | { | 403 | { |
404 | if (str->data) | 404 | free(str->data); |
405 | free(str->data); | ||
406 | str->data = data; | 405 | str->data = data; |
407 | str->length = len; | 406 | str->length = len; |
408 | } | 407 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/asn_mime.c b/src/lib/libssl/src/crypto/asn1/asn_mime.c index 5d70b76f05..f123a7ddc0 100644 --- a/src/lib/libssl/src/crypto/asn1/asn_mime.c +++ b/src/lib/libssl/src/crypto/asn1/asn_mime.c | |||
@@ -949,10 +949,8 @@ mime_param_find(MIME_HEADER *hdr, char *name) | |||
949 | static void | 949 | static void |
950 | mime_hdr_free(MIME_HEADER *hdr) | 950 | mime_hdr_free(MIME_HEADER *hdr) |
951 | { | 951 | { |
952 | if (hdr->name) | 952 | free(hdr->name); |
953 | free(hdr->name); | 953 | free(hdr->value); |
954 | if (hdr->value) | ||
955 | free(hdr->value); | ||
956 | if (hdr->params) | 954 | if (hdr->params) |
957 | sk_MIME_PARAM_pop_free(hdr->params, mime_param_free); | 955 | sk_MIME_PARAM_pop_free(hdr->params, mime_param_free); |
958 | free(hdr); | 956 | free(hdr); |
@@ -961,10 +959,8 @@ mime_hdr_free(MIME_HEADER *hdr) | |||
961 | static void | 959 | static void |
962 | mime_param_free(MIME_PARAM *param) | 960 | mime_param_free(MIME_PARAM *param) |
963 | { | 961 | { |
964 | if (param->param_name) | 962 | free(param->param_name); |
965 | free(param->param_name); | 963 | free(param->param_value); |
966 | if (param->param_value) | ||
967 | free(param->param_value); | ||
968 | free(param); | 964 | free(param); |
969 | } | 965 | } |
970 | 966 | ||
diff --git a/src/lib/libssl/src/crypto/asn1/bio_asn1.c b/src/lib/libssl/src/crypto/asn1/bio_asn1.c index 327355eeda..223461d933 100644 --- a/src/lib/libssl/src/crypto/asn1/bio_asn1.c +++ b/src/lib/libssl/src/crypto/asn1/bio_asn1.c | |||
@@ -186,8 +186,7 @@ asn1_bio_free(BIO *b) | |||
186 | ctx = (BIO_ASN1_BUF_CTX *) b->ptr; | 186 | ctx = (BIO_ASN1_BUF_CTX *) b->ptr; |
187 | if (ctx == NULL) | 187 | if (ctx == NULL) |
188 | return 0; | 188 | return 0; |
189 | if (ctx->buf) | 189 | free(ctx->buf); |
190 | free(ctx->buf); | ||
191 | free(ctx); | 190 | free(ctx); |
192 | b->init = 0; | 191 | b->init = 0; |
193 | b->ptr = NULL; | 192 | b->ptr = NULL; |
diff --git a/src/lib/libssl/src/crypto/asn1/bio_ndef.c b/src/lib/libssl/src/crypto/asn1/bio_ndef.c index 66be025127..f7fa2e69bc 100644 --- a/src/lib/libssl/src/crypto/asn1/bio_ndef.c +++ b/src/lib/libssl/src/crypto/asn1/bio_ndef.c | |||
@@ -186,8 +186,7 @@ ndef_prefix_free(BIO *b, unsigned char **pbuf, int *plen, void *parg) | |||
186 | 186 | ||
187 | ndef_aux = *(NDEF_SUPPORT **)parg; | 187 | ndef_aux = *(NDEF_SUPPORT **)parg; |
188 | 188 | ||
189 | if (ndef_aux->derbuf) | 189 | free(ndef_aux->derbuf); |
190 | free(ndef_aux->derbuf); | ||
191 | 190 | ||
192 | ndef_aux->derbuf = NULL; | 191 | ndef_aux->derbuf = NULL; |
193 | *pbuf = NULL; | 192 | *pbuf = NULL; |
diff --git a/src/lib/libssl/src/crypto/asn1/tasn_dec.c b/src/lib/libssl/src/crypto/asn1/tasn_dec.c index c8b379f371..b524104d91 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_dec.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_dec.c | |||
@@ -951,8 +951,7 @@ asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, | |||
951 | } | 951 | } |
952 | /* If we've already allocated a buffer use it */ | 952 | /* If we've already allocated a buffer use it */ |
953 | if (*free_cont) { | 953 | if (*free_cont) { |
954 | if (stmp->data) | 954 | free(stmp->data); |
955 | free(stmp->data); | ||
956 | stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */ | 955 | stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */ |
957 | stmp->length = len; | 956 | stmp->length = len; |
958 | *free_cont = 0; | 957 | *free_cont = 0; |
diff --git a/src/lib/libssl/src/crypto/asn1/tasn_utl.c b/src/lib/libssl/src/crypto/asn1/tasn_utl.c index e1051c2c3e..446a6f82bd 100644 --- a/src/lib/libssl/src/crypto/asn1/tasn_utl.c +++ b/src/lib/libssl/src/crypto/asn1/tasn_utl.c | |||
@@ -153,8 +153,7 @@ asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
153 | 153 | ||
154 | enc = asn1_get_enc_ptr(pval, it); | 154 | enc = asn1_get_enc_ptr(pval, it); |
155 | if (enc) { | 155 | if (enc) { |
156 | if (enc->enc) | 156 | free(enc->enc); |
157 | free(enc->enc); | ||
158 | enc->enc = NULL; | 157 | enc->enc = NULL; |
159 | enc->len = 0; | 158 | enc->len = 0; |
160 | enc->modified = 1; | 159 | enc->modified = 1; |
@@ -171,8 +170,7 @@ asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, | |||
171 | if (!enc) | 170 | if (!enc) |
172 | return 1; | 171 | return 1; |
173 | 172 | ||
174 | if (enc->enc) | 173 | free(enc->enc); |
175 | free(enc->enc); | ||
176 | enc->enc = malloc(inlen); | 174 | enc->enc = malloc(inlen); |
177 | if (!enc->enc) | 175 | if (!enc->enc) |
178 | return 0; | 176 | return 0; |
diff --git a/src/lib/libssl/src/crypto/asn1/x_name.c b/src/lib/libssl/src/crypto/asn1/x_name.c index 70459babc4..366ff17976 100644 --- a/src/lib/libssl/src/crypto/asn1/x_name.c +++ b/src/lib/libssl/src/crypto/asn1/x_name.c | |||
@@ -164,8 +164,7 @@ x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) | |||
164 | 164 | ||
165 | BUF_MEM_free(a->bytes); | 165 | BUF_MEM_free(a->bytes); |
166 | sk_X509_NAME_ENTRY_pop_free(a->entries, X509_NAME_ENTRY_free); | 166 | sk_X509_NAME_ENTRY_pop_free(a->entries, X509_NAME_ENTRY_free); |
167 | if (a->canon_enc) | 167 | free(a->canon_enc); |
168 | free(a->canon_enc); | ||
169 | free(a); | 168 | free(a); |
170 | *pval = NULL; | 169 | *pval = NULL; |
171 | } | 170 | } |
diff --git a/src/lib/libssl/src/crypto/asn1/x_pubkey.c b/src/lib/libssl/src/crypto/asn1/x_pubkey.c index df915e2dfd..f8b22fc372 100644 --- a/src/lib/libssl/src/crypto/asn1/x_pubkey.c +++ b/src/lib/libssl/src/crypto/asn1/x_pubkey.c | |||
@@ -355,8 +355,7 @@ X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj, int ptype, | |||
355 | if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval)) | 355 | if (!X509_ALGOR_set0(pub->algor, aobj, ptype, pval)) |
356 | return 0; | 356 | return 0; |
357 | if (penc) { | 357 | if (penc) { |
358 | if (pub->public_key->data) | 358 | free(pub->public_key->data); |
359 | free(pub->public_key->data); | ||
360 | pub->public_key->data = penc; | 359 | pub->public_key->data = penc; |
361 | pub->public_key->length = penclen; | 360 | pub->public_key->length = penclen; |
362 | /* Set number of unused bits to zero */ | 361 | /* Set number of unused bits to zero */ |
diff --git a/src/lib/libssl/src/crypto/conf/conf_mod.c b/src/lib/libssl/src/crypto/conf/conf_mod.c index b574104791..f7fdbfa670 100644 --- a/src/lib/libssl/src/crypto/conf/conf_mod.c +++ b/src/lib/libssl/src/crypto/conf/conf_mod.c | |||
@@ -386,10 +386,8 @@ err: | |||
386 | 386 | ||
387 | memerr: | 387 | memerr: |
388 | if (imod) { | 388 | if (imod) { |
389 | if (imod->name) | 389 | free(imod->name); |
390 | free(imod->name); | 390 | free(imod->value); |
391 | if (imod->value) | ||
392 | free(imod->value); | ||
393 | free(imod); | 391 | free(imod); |
394 | } | 392 | } |
395 | 393 | ||
diff --git a/src/lib/libssl/src/crypto/dh/dh_lib.c b/src/lib/libssl/src/crypto/dh/dh_lib.c index e09c5fdd21..7a680cc5b4 100644 --- a/src/lib/libssl/src/crypto/dh/dh_lib.c +++ b/src/lib/libssl/src/crypto/dh/dh_lib.c | |||
@@ -193,7 +193,7 @@ void DH_free(DH *r) | |||
193 | if (r->g != NULL) BN_clear_free(r->g); | 193 | if (r->g != NULL) BN_clear_free(r->g); |
194 | if (r->q != NULL) BN_clear_free(r->q); | 194 | if (r->q != NULL) BN_clear_free(r->q); |
195 | if (r->j != NULL) BN_clear_free(r->j); | 195 | if (r->j != NULL) BN_clear_free(r->j); |
196 | if (r->seed) free(r->seed); | 196 | free(r->seed); |
197 | if (r->counter != NULL) BN_clear_free(r->counter); | 197 | if (r->counter != NULL) BN_clear_free(r->counter); |
198 | if (r->pub_key != NULL) BN_clear_free(r->pub_key); | 198 | if (r->pub_key != NULL) BN_clear_free(r->pub_key); |
199 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); | 199 | if (r->priv_key != NULL) BN_clear_free(r->priv_key); |
diff --git a/src/lib/libssl/src/crypto/dso/dso_lib.c b/src/lib/libssl/src/crypto/dso/dso_lib.c index 882b9c2fcb..3859be7b42 100644 --- a/src/lib/libssl/src/crypto/dso/dso_lib.c +++ b/src/lib/libssl/src/crypto/dso/dso_lib.c | |||
@@ -361,8 +361,7 @@ DSO_set_filename(DSO *dso, const char *filename) | |||
361 | DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE); | 361 | DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE); |
362 | return (0); | 362 | return (0); |
363 | } | 363 | } |
364 | if (dso->filename) | 364 | free(dso->filename); |
365 | free(dso->filename); | ||
366 | dso->filename = copied; | 365 | dso->filename = copied; |
367 | return (1); | 366 | return (1); |
368 | } | 367 | } |
diff --git a/src/lib/libssl/src/crypto/ec/ec_lib.c b/src/lib/libssl/src/crypto/ec/ec_lib.c index b37efac246..3313573a05 100644 --- a/src/lib/libssl/src/crypto/ec/ec_lib.c +++ b/src/lib/libssl/src/crypto/ec/ec_lib.c | |||
@@ -130,8 +130,7 @@ EC_GROUP_free(EC_GROUP * group) | |||
130 | BN_free(&group->order); | 130 | BN_free(&group->order); |
131 | BN_free(&group->cofactor); | 131 | BN_free(&group->cofactor); |
132 | 132 | ||
133 | if (group->seed) | 133 | free(group->seed); |
134 | free(group->seed); | ||
135 | 134 | ||
136 | free(group); | 135 | free(group); |
137 | } | 136 | } |
@@ -218,8 +217,7 @@ EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src) | |||
218 | dest->asn1_form = src->asn1_form; | 217 | dest->asn1_form = src->asn1_form; |
219 | 218 | ||
220 | if (src->seed) { | 219 | if (src->seed) { |
221 | if (dest->seed) | 220 | free(dest->seed); |
222 | free(dest->seed); | ||
223 | dest->seed = malloc(src->seed_len); | 221 | dest->seed = malloc(src->seed_len); |
224 | if (dest->seed == NULL) | 222 | if (dest->seed == NULL) |
225 | return 0; | 223 | return 0; |
@@ -227,8 +225,7 @@ EC_GROUP_copy(EC_GROUP * dest, const EC_GROUP * src) | |||
227 | return 0; | 225 | return 0; |
228 | dest->seed_len = src->seed_len; | 226 | dest->seed_len = src->seed_len; |
229 | } else { | 227 | } else { |
230 | if (dest->seed) | 228 | free(dest->seed); |
231 | free(dest->seed); | ||
232 | dest->seed = NULL; | 229 | dest->seed = NULL; |
233 | dest->seed_len = 0; | 230 | dest->seed_len = 0; |
234 | } | 231 | } |
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c index 7d55045164..7da9913d28 100644 --- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c +++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c | |||
@@ -926,8 +926,7 @@ zapparams(struct crypt_kop *kop) | |||
926 | int i; | 926 | int i; |
927 | 927 | ||
928 | for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) { | 928 | for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) { |
929 | if (kop->crk_param[i].crp_p) | 929 | free(kop->crk_param[i].crp_p); |
930 | free(kop->crk_param[i].crp_p); | ||
931 | kop->crk_param[i].crp_p = NULL; | 930 | kop->crk_param[i].crp_p = NULL; |
932 | kop->crk_param[i].crp_nbits = 0; | 931 | kop->crk_param[i].crp_nbits = 0; |
933 | } | 932 | } |
diff --git a/src/lib/libssl/src/crypto/evp/evp_enc.c b/src/lib/libssl/src/crypto/evp/evp_enc.c index 0c3e8fcc39..afe34f6f3f 100644 --- a/src/lib/libssl/src/crypto/evp/evp_enc.c +++ b/src/lib/libssl/src/crypto/evp/evp_enc.c | |||
@@ -548,8 +548,7 @@ EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | |||
548 | if (c->cipher_data) | 548 | if (c->cipher_data) |
549 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); | 549 | OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size); |
550 | } | 550 | } |
551 | if (c->cipher_data) | 551 | free(c->cipher_data); |
552 | free(c->cipher_data); | ||
553 | #ifndef OPENSSL_NO_ENGINE | 552 | #ifndef OPENSSL_NO_ENGINE |
554 | if (c->engine) | 553 | if (c->engine) |
555 | /* The EVP_CIPHER we used belongs to an ENGINE, release the | 554 | /* The EVP_CIPHER we used belongs to an ENGINE, release the |
diff --git a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c index a42b4f03f4..894d51d532 100644 --- a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c +++ b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c | |||
@@ -110,8 +110,7 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) | |||
110 | { | 110 | { |
111 | if (rctx->mem) | 111 | if (rctx->mem) |
112 | BIO_free(rctx->mem); | 112 | BIO_free(rctx->mem); |
113 | if (rctx->iobuf) | 113 | free(rctx->iobuf); |
114 | free(rctx->iobuf); | ||
115 | free(rctx); | 114 | free(rctx); |
116 | } | 115 | } |
117 | 116 | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c b/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c index 5580b7783a..e75596afa3 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c | |||
@@ -148,8 +148,7 @@ static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx) | |||
148 | { | 148 | { |
149 | if (rctx->pub_exp) | 149 | if (rctx->pub_exp) |
150 | BN_free(rctx->pub_exp); | 150 | BN_free(rctx->pub_exp); |
151 | if (rctx->tbuf) | 151 | free(rctx->tbuf); |
152 | free(rctx->tbuf); | ||
153 | free(rctx); | 152 | free(rctx); |
154 | } | 153 | } |
155 | } | 154 | } |
diff --git a/src/lib/libssl/src/crypto/x509/by_dir.c b/src/lib/libssl/src/crypto/x509/by_dir.c index fdfca6140a..554f6600dc 100644 --- a/src/lib/libssl/src/crypto/x509/by_dir.c +++ b/src/lib/libssl/src/crypto/x509/by_dir.c | |||
@@ -184,8 +184,7 @@ by_dir_hash_cmp(const BY_DIR_HASH * const *a, | |||
184 | static void | 184 | static void |
185 | by_dir_entry_free(BY_DIR_ENTRY *ent) | 185 | by_dir_entry_free(BY_DIR_ENTRY *ent) |
186 | { | 186 | { |
187 | if (ent->dir) | 187 | free(ent->dir); |
188 | free(ent->dir); | ||
189 | if (ent->hashes) | 188 | if (ent->hashes) |
190 | sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); | 189 | sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); |
191 | free(ent); | 190 | free(ent); |
diff --git a/src/lib/libssl/src/crypto/x509/x509_vpm.c b/src/lib/libssl/src/crypto/x509/x509_vpm.c index c2cebd936f..3ee3116ac1 100644 --- a/src/lib/libssl/src/crypto/x509/x509_vpm.c +++ b/src/lib/libssl/src/crypto/x509/x509_vpm.c | |||
@@ -212,8 +212,7 @@ X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, const X509_VERIFY_PARAM *from) | |||
212 | int | 212 | int |
213 | X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) | 213 | X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name) |
214 | { | 214 | { |
215 | if (param->name) | 215 | free(param->name); |
216 | free(param->name); | ||
217 | param->name = BUF_strdup(name); | 216 | param->name = BUF_strdup(name); |
218 | if (param->name) | 217 | if (param->name) |
219 | return 1; | 218 | return 1; |