diff options
| author | tedu <> | 2014-05-30 02:52:11 +0000 |
|---|---|---|
| committer | tedu <> | 2014-05-30 02:52:11 +0000 |
| commit | c442171f7692d3610a7aa5a08593cabf7253c5af (patch) | |
| tree | a802460259115af2ecf6be49736b1b6a09173232 /src/lib/libcrypto/asn1 | |
| parent | 60f672682a47559e679725da4d8dc8efa1ddceff (diff) | |
| download | openbsd-c442171f7692d3610a7aa5a08593cabf7253c5af.tar.gz openbsd-c442171f7692d3610a7aa5a08593cabf7253c5af.tar.bz2 openbsd-c442171f7692d3610a7aa5a08593cabf7253c5af.zip | |
no need for null check before free. from Brendan MacDonell
Diffstat (limited to 'src/lib/libcrypto/asn1')
| -rw-r--r-- | src/lib/libcrypto/asn1/ameth_lib.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_lib.c | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/asn_mime.c | 12 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/bio_asn1.c | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/bio_ndef.c | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/tasn_dec.c | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/tasn_utl.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/x_name.c | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/x_pubkey.c | 3 |
9 files changed, 14 insertions, 28 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 */ |
