summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authordoug <>2014-07-25 06:05:32 +0000
committerdoug <>2014-07-25 06:05:32 +0000
commita2f907def2edfc825d9e3cec19c6bc1c6c035661 (patch)
tree557034a0625ab745a7737c138d34237c330c8398 /src/lib
parent0fd923e655a19db310ce5eb91695efa0cf8aab89 (diff)
downloadopenbsd-a2f907def2edfc825d9e3cec19c6bc1c6c035661.tar.gz
openbsd-a2f907def2edfc825d9e3cec19c6bc1c6c035661.tar.bz2
openbsd-a2f907def2edfc825d9e3cec19c6bc1c6c035661.zip
BIO_free() returns immediately when the sole input is NULL.
Remove unnecessary NULL check. ok miod@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/asn1/bio_ndef.c5
-rw-r--r--src/lib/libcrypto/bio/bio_lib.c5
-rw-r--r--src/lib/libcrypto/bio/bss_acpt.c8
-rw-r--r--src/lib/libcrypto/cms/cms_lib.c5
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_ht.c5
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_doit.c5
-rw-r--r--src/lib/libcrypto/x509/by_file.c8
-rw-r--r--src/lib/libssl/src/apps/apps.c11
-rw-r--r--src/lib/libssl/src/apps/dh.c5
-rw-r--r--src/lib/libssl/src/apps/dhparam.c5
-rw-r--r--src/lib/libssl/src/apps/dsa.c5
-rw-r--r--src/lib/libssl/src/apps/dsaparam.c5
-rw-r--r--src/lib/libssl/src/apps/ec.c5
-rw-r--r--src/lib/libssl/src/apps/ecparam.c5
-rw-r--r--src/lib/libssl/src/apps/enc.c14
-rw-r--r--src/lib/libssl/src/apps/gendsa.c5
-rw-r--r--src/lib/libssl/src/apps/passwd.c5
-rw-r--r--src/lib/libssl/src/apps/s_server.c5
-rw-r--r--src/lib/libssl/src/apps/sess_id.c5
-rw-r--r--src/lib/libssl/src/crypto/asn1/bio_ndef.c5
-rw-r--r--src/lib/libssl/src/crypto/bio/bio_lib.c5
-rw-r--r--src/lib/libssl/src/crypto/bio/bss_acpt.c8
-rw-r--r--src/lib/libssl/src/crypto/cms/cms_lib.c5
-rw-r--r--src/lib/libssl/src/crypto/ocsp/ocsp_ht.c5
-rw-r--r--src/lib/libssl/src/crypto/pkcs7/pk7_doit.c5
-rw-r--r--src/lib/libssl/src/crypto/x509/by_file.c8
26 files changed, 61 insertions, 96 deletions
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c
index fd6b0e5f17..1a23c27d04 100644
--- a/src/lib/libcrypto/asn1/bio_ndef.c
+++ b/src/lib/libcrypto/asn1/bio_ndef.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_ndef.c,v 1.8 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: bio_ndef.c,v 1.9 2014/07/25 06:05:32 doug Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -144,8 +144,7 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
144 return sarg.ndef_bio; 144 return sarg.ndef_bio;
145 145
146err: 146err:
147 if (asn_bio) 147 BIO_free(asn_bio);
148 BIO_free(asn_bio);
149 free(ndef_aux); 148 free(ndef_aux);
150 return NULL; 149 return NULL;
151} 150}
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c
index a2b34a2f80..477208ed1f 100644
--- a/src/lib/libcrypto/bio/bio_lib.c
+++ b/src/lib/libcrypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_lib.c,v 1.20 2014/07/11 15:40:32 miod Exp $ */ 1/* $OpenBSD: bio_lib.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -575,8 +575,7 @@ BIO_dup_chain(BIO *in)
575 } 575 }
576 return (ret); 576 return (ret);
577err: 577err:
578 if (ret != NULL) 578 BIO_free(ret);
579 BIO_free(ret);
580 return (NULL); 579 return (NULL);
581 580
582} 581}
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c
index 65d4bb2547..b6131c4d41 100644
--- a/src/lib/libcrypto/bio/bss_acpt.c
+++ b/src/lib/libcrypto/bio/bss_acpt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bss_acpt.c,v 1.24 2014/07/13 16:03:09 beck Exp $ */ 1/* $OpenBSD: bss_acpt.c,v 1.25 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -153,8 +153,7 @@ BIO_ACCEPT_free(BIO_ACCEPT *a)
153 153
154 free(a->param_addr); 154 free(a->param_addr);
155 free(a->addr); 155 free(a->addr);
156 if (a->bio_chain != NULL) 156 BIO_free(a->bio_chain);
157 BIO_free(a->bio_chain);
158 free(a); 157 free(a);
159} 158}
160 159
@@ -358,8 +357,7 @@ acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
358 } else if (num == 1) { 357 } else if (num == 1) {
359 data->accept_nbio = (ptr != NULL); 358 data->accept_nbio = (ptr != NULL);
360 } else if (num == 2) { 359 } else if (num == 2) {
361 if (data->bio_chain != NULL) 360 BIO_free(data->bio_chain);
362 BIO_free(data->bio_chain);
363 data->bio_chain = (BIO *)ptr; 361 data->bio_chain = (BIO *)ptr;
364 } 362 }
365 } 363 }
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c
index ee1f06c89a..4ca38e2428 100644
--- a/src/lib/libcrypto/cms/cms_lib.c
+++ b/src/lib/libcrypto/cms/cms_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_lib.c,v 1.3 2014/06/12 15:49:28 deraadt Exp $ */ 1/* $OpenBSD: cms_lib.c,v 1.4 2014/07/25 06:05:32 doug Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -360,8 +360,7 @@ cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm)
360 return mdbio; 360 return mdbio;
361 361
362err: 362err:
363 if (mdbio) 363 BIO_free(mdbio);
364 BIO_free(mdbio);
365 return NULL; 364 return NULL;
366} 365}
367 366
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c
index c895e9df4d..5d1627192c 100644
--- a/src/lib/libcrypto/ocsp/ocsp_ht.c
+++ b/src/lib/libcrypto/ocsp/ocsp_ht.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_ht.c,v 1.20 2014/07/12 14:58:32 miod Exp $ */ 1/* $OpenBSD: ocsp_ht.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -111,8 +111,7 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
111 if (rctx == NULL) 111 if (rctx == NULL)
112 return; 112 return;
113 113
114 if (rctx->mem) 114 BIO_free(rctx->mem);
115 BIO_free(rctx->mem);
116 free(rctx->iobuf); 115 free(rctx->iobuf);
117 free(rctx); 116 free(rctx);
118} 117}
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c
index cc6fd97b9d..8f1e393635 100644
--- a/src/lib/libcrypto/pkcs7/pk7_doit.c
+++ b/src/lib/libcrypto/pkcs7/pk7_doit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_doit.c,v 1.28 2014/07/12 16:03:37 miod Exp $ */ 1/* $OpenBSD: pk7_doit.c,v 1.29 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -133,8 +133,7 @@ PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg)
133 return 1; 133 return 1;
134 134
135err: 135err:
136 if (btmp) 136 BIO_free(btmp);
137 BIO_free(btmp);
138 return 0; 137 return 0;
139 138
140} 139}
diff --git a/src/lib/libcrypto/x509/by_file.c b/src/lib/libcrypto/x509/by_file.c
index 10adcfbd77..04366460bb 100644
--- a/src/lib/libcrypto/x509/by_file.c
+++ b/src/lib/libcrypto/x509/by_file.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: by_file.c,v 1.15 2014/07/11 08:44:49 jsing Exp $ */ 1/* $OpenBSD: by_file.c,v 1.16 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -182,8 +182,7 @@ X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type)
182err: 182err:
183 if (x != NULL) 183 if (x != NULL)
184 X509_free(x); 184 X509_free(x);
185 if (in != NULL) 185 BIO_free(in);
186 BIO_free(in);
187 return (ret); 186 return (ret);
188} 187}
189 188
@@ -243,8 +242,7 @@ X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type)
243err: 242err:
244 if (x != NULL) 243 if (x != NULL)
245 X509_CRL_free(x); 244 X509_CRL_free(x);
246 if (in != NULL) 245 BIO_free(in);
247 BIO_free(in);
248 return (ret); 246 return (ret);
249} 247}
250 248
diff --git a/src/lib/libssl/src/apps/apps.c b/src/lib/libssl/src/apps/apps.c
index f9e845246f..7e7086a1c7 100644
--- a/src/lib/libssl/src/apps/apps.c
+++ b/src/lib/libssl/src/apps/apps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: apps.c,v 1.68 2014/07/19 03:40:26 lteo Exp $ */ 1/* $OpenBSD: apps.c,v 1.69 2014/07/25 06:05:31 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -669,8 +669,7 @@ end:
669 BIO_printf(err, "unable to load certificate\n"); 669 BIO_printf(err, "unable to load certificate\n");
670 ERR_print_errors(err); 670 ERR_print_errors(err);
671 } 671 }
672 if (cert != NULL) 672 BIO_free(cert);
673 BIO_free(cert);
674 return (x); 673 return (x);
675} 674}
676 675
@@ -745,8 +744,7 @@ load_key(BIO *err, const char *file, int format, int maybe_stdin,
745 goto end; 744 goto end;
746 } 745 }
747end: 746end:
748 if (key != NULL) 747 BIO_free(key);
749 BIO_free(key);
750 if (pkey == NULL) { 748 if (pkey == NULL) {
751 BIO_printf(err, "unable to load %s\n", key_descrip); 749 BIO_printf(err, "unable to load %s\n", key_descrip);
752 ERR_print_errors(err); 750 ERR_print_errors(err);
@@ -833,8 +831,7 @@ load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
833 } 831 }
834 832
835end: 833end:
836 if (key != NULL) 834 BIO_free(key);
837 BIO_free(key);
838 if (pkey == NULL) 835 if (pkey == NULL)
839 BIO_printf(err, "unable to load %s\n", key_descrip); 836 BIO_printf(err, "unable to load %s\n", key_descrip);
840 return (pkey); 837 return (pkey);
diff --git a/src/lib/libssl/src/apps/dh.c b/src/lib/libssl/src/apps/dh.c
index 1485dedb55..ce000820f0 100644
--- a/src/lib/libssl/src/apps/dh.c
+++ b/src/lib/libssl/src/apps/dh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.c,v 1.25 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: dh.c,v 1.26 2014/07/25 06:05:31 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -297,8 +297,7 @@ bad:
297 ret = 0; 297 ret = 0;
298 298
299end: 299end:
300 if (in != NULL) 300 BIO_free(in);
301 BIO_free(in);
302 if (out != NULL) 301 if (out != NULL)
303 BIO_free_all(out); 302 BIO_free_all(out);
304 if (dh != NULL) 303 if (dh != NULL)
diff --git a/src/lib/libssl/src/apps/dhparam.c b/src/lib/libssl/src/apps/dhparam.c
index 23fb2a5789..1c41ff6e1b 100644
--- a/src/lib/libssl/src/apps/dhparam.c
+++ b/src/lib/libssl/src/apps/dhparam.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dhparam.c,v 1.33 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: dhparam.c,v 1.34 2014/07/25 06:05:31 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -441,8 +441,7 @@ bad:
441 ret = 0; 441 ret = 0;
442 442
443end: 443end:
444 if (in != NULL) 444 BIO_free(in);
445 BIO_free(in);
446 if (out != NULL) 445 if (out != NULL)
447 BIO_free_all(out); 446 BIO_free_all(out);
448 if (dh != NULL) 447 if (dh != NULL)
diff --git a/src/lib/libssl/src/apps/dsa.c b/src/lib/libssl/src/apps/dsa.c
index 287ecc4cda..2b90d4fb1a 100644
--- a/src/lib/libssl/src/apps/dsa.c
+++ b/src/lib/libssl/src/apps/dsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa.c,v 1.28 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: dsa.c,v 1.29 2014/07/25 06:05:31 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -320,8 +320,7 @@ bad:
320 } else 320 } else
321 ret = 0; 321 ret = 0;
322end: 322end:
323 if (in != NULL) 323 BIO_free(in);
324 BIO_free(in);
325 if (out != NULL) 324 if (out != NULL)
326 BIO_free_all(out); 325 BIO_free_all(out);
327 if (dsa != NULL) 326 if (dsa != NULL)
diff --git a/src/lib/libssl/src/apps/dsaparam.c b/src/lib/libssl/src/apps/dsaparam.c
index 5980da69b0..46f41a57fb 100644
--- a/src/lib/libssl/src/apps/dsaparam.c
+++ b/src/lib/libssl/src/apps/dsaparam.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsaparam.c,v 1.34 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: dsaparam.c,v 1.35 2014/07/25 06:05:31 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -382,8 +382,7 @@ bad:
382 ret = 0; 382 ret = 0;
383 383
384end: 384end:
385 if (in != NULL) 385 BIO_free(in);
386 BIO_free(in);
387 if (out != NULL) 386 if (out != NULL)
388 BIO_free_all(out); 387 BIO_free_all(out);
389 if (dsa != NULL) 388 if (dsa != NULL)
diff --git a/src/lib/libssl/src/apps/ec.c b/src/lib/libssl/src/apps/ec.c
index e60fddf99e..82a98dd21f 100644
--- a/src/lib/libssl/src/apps/ec.c
+++ b/src/lib/libssl/src/apps/ec.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec.c,v 1.16 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: ec.c,v 1.17 2014/07/25 06:05:32 doug Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -328,8 +328,7 @@ bad:
328 } else 328 } else
329 ret = 0; 329 ret = 0;
330end: 330end:
331 if (in) 331 BIO_free(in);
332 BIO_free(in);
333 if (out) 332 if (out)
334 BIO_free_all(out); 333 BIO_free_all(out);
335 if (eckey) 334 if (eckey)
diff --git a/src/lib/libssl/src/apps/ecparam.c b/src/lib/libssl/src/apps/ecparam.c
index e8e843ed20..9f7c287d9c 100644
--- a/src/lib/libssl/src/apps/ecparam.c
+++ b/src/lib/libssl/src/apps/ecparam.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecparam.c,v 1.23 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: ecparam.c,v 1.24 2014/07/25 06:05:32 doug Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -578,8 +578,7 @@ end:
578 if (ec_cofactor) 578 if (ec_cofactor)
579 BN_free(ec_cofactor); 579 BN_free(ec_cofactor);
580 free(buffer); 580 free(buffer);
581 if (in != NULL) 581 BIO_free(in);
582 BIO_free(in);
583 if (out != NULL) 582 if (out != NULL)
584 BIO_free_all(out); 583 BIO_free_all(out);
585 if (group != NULL) 584 if (group != NULL)
diff --git a/src/lib/libssl/src/apps/enc.c b/src/lib/libssl/src/apps/enc.c
index 3464290918..d1943bfa22 100644
--- a/src/lib/libssl/src/apps/enc.c
+++ b/src/lib/libssl/src/apps/enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: enc.c,v 1.38 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: enc.c,v 1.39 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -600,17 +600,13 @@ end:
600 ERR_print_errors(bio_err); 600 ERR_print_errors(bio_err);
601 free(strbuf); 601 free(strbuf);
602 free(buff); 602 free(buff);
603 if (in != NULL) 603 BIO_free(in);
604 BIO_free(in);
605 if (out != NULL) 604 if (out != NULL)
606 BIO_free_all(out); 605 BIO_free_all(out);
607 if (benc != NULL) 606 BIO_free(benc);
608 BIO_free(benc); 607 BIO_free(b64);
609 if (b64 != NULL)
610 BIO_free(b64);
611#ifdef ZLIB 608#ifdef ZLIB
612 if (bzl != NULL) 609 BIO_free(bzl);
613 BIO_free(bzl);
614#endif 610#endif
615 free(pass); 611 free(pass);
616 612
diff --git a/src/lib/libssl/src/apps/gendsa.c b/src/lib/libssl/src/apps/gendsa.c
index 919b40af83..d45e237103 100644
--- a/src/lib/libssl/src/apps/gendsa.c
+++ b/src/lib/libssl/src/apps/gendsa.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gendsa.c,v 1.30 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: gendsa.c,v 1.31 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -219,8 +219,7 @@ bad:
219end: 219end:
220 if (ret != 0) 220 if (ret != 0)
221 ERR_print_errors(bio_err); 221 ERR_print_errors(bio_err);
222 if (in != NULL) 222 BIO_free(in);
223 BIO_free(in);
224 if (out != NULL) 223 if (out != NULL)
225 BIO_free_all(out); 224 BIO_free_all(out);
226 if (dsa != NULL) 225 if (dsa != NULL)
diff --git a/src/lib/libssl/src/apps/passwd.c b/src/lib/libssl/src/apps/passwd.c
index b9a74bbd0c..6a16a475a9 100644
--- a/src/lib/libssl/src/apps/passwd.c
+++ b/src/lib/libssl/src/apps/passwd.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: passwd.c,v 1.23 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: passwd.c,v 1.24 2014/07/25 06:05:32 doug Exp $ */
2 2
3#if defined OPENSSL_NO_MD5 3#if defined OPENSSL_NO_MD5
4#define NO_MD5CRYPT_1 4#define NO_MD5CRYPT_1
@@ -242,8 +242,7 @@ err:
242 ERR_print_errors(bio_err); 242 ERR_print_errors(bio_err);
243 free(salt_malloc); 243 free(salt_malloc);
244 free(passwd_malloc); 244 free(passwd_malloc);
245 if (in) 245 BIO_free(in);
246 BIO_free(in);
247 if (out) 246 if (out)
248 BIO_free_all(out); 247 BIO_free_all(out);
249 248
diff --git a/src/lib/libssl/src/apps/s_server.c b/src/lib/libssl/src/apps/s_server.c
index b6e16f31ae..3deebcfc35 100644
--- a/src/lib/libssl/src/apps/s_server.c
+++ b/src/lib/libssl/src/apps/s_server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_server.c,v 1.61 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: s_server.c,v 1.62 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1773,8 +1773,7 @@ load_dh_param(const char *dhfile)
1773 goto err; 1773 goto err;
1774 ret = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); 1774 ret = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
1775err: 1775err:
1776 if (bio != NULL) 1776 BIO_free(bio);
1777 BIO_free(bio);
1778 return (ret); 1777 return (ret);
1779} 1778}
1780#endif 1779#endif
diff --git a/src/lib/libssl/src/apps/sess_id.c b/src/lib/libssl/src/apps/sess_id.c
index e841003cf6..0022abc436 100644
--- a/src/lib/libssl/src/apps/sess_id.c
+++ b/src/lib/libssl/src/apps/sess_id.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sess_id.c,v 1.19 2014/07/14 00:35:10 deraadt Exp $ */ 1/* $OpenBSD: sess_id.c,v 1.20 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -277,7 +277,6 @@ load_sess_id(char *infile, int format)
277 goto end; 277 goto end;
278 } 278 }
279end: 279end:
280 if (in != NULL) 280 BIO_free(in);
281 BIO_free(in);
282 return (x); 281 return (x);
283} 282}
diff --git a/src/lib/libssl/src/crypto/asn1/bio_ndef.c b/src/lib/libssl/src/crypto/asn1/bio_ndef.c
index fd6b0e5f17..1a23c27d04 100644
--- a/src/lib/libssl/src/crypto/asn1/bio_ndef.c
+++ b/src/lib/libssl/src/crypto/asn1/bio_ndef.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_ndef.c,v 1.8 2014/06/12 15:49:27 deraadt Exp $ */ 1/* $OpenBSD: bio_ndef.c,v 1.9 2014/07/25 06:05:32 doug Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -144,8 +144,7 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
144 return sarg.ndef_bio; 144 return sarg.ndef_bio;
145 145
146err: 146err:
147 if (asn_bio) 147 BIO_free(asn_bio);
148 BIO_free(asn_bio);
149 free(ndef_aux); 148 free(ndef_aux);
150 return NULL; 149 return NULL;
151} 150}
diff --git a/src/lib/libssl/src/crypto/bio/bio_lib.c b/src/lib/libssl/src/crypto/bio/bio_lib.c
index a2b34a2f80..477208ed1f 100644
--- a/src/lib/libssl/src/crypto/bio/bio_lib.c
+++ b/src/lib/libssl/src/crypto/bio/bio_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_lib.c,v 1.20 2014/07/11 15:40:32 miod Exp $ */ 1/* $OpenBSD: bio_lib.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -575,8 +575,7 @@ BIO_dup_chain(BIO *in)
575 } 575 }
576 return (ret); 576 return (ret);
577err: 577err:
578 if (ret != NULL) 578 BIO_free(ret);
579 BIO_free(ret);
580 return (NULL); 579 return (NULL);
581 580
582} 581}
diff --git a/src/lib/libssl/src/crypto/bio/bss_acpt.c b/src/lib/libssl/src/crypto/bio/bss_acpt.c
index 65d4bb2547..b6131c4d41 100644
--- a/src/lib/libssl/src/crypto/bio/bss_acpt.c
+++ b/src/lib/libssl/src/crypto/bio/bss_acpt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bss_acpt.c,v 1.24 2014/07/13 16:03:09 beck Exp $ */ 1/* $OpenBSD: bss_acpt.c,v 1.25 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -153,8 +153,7 @@ BIO_ACCEPT_free(BIO_ACCEPT *a)
153 153
154 free(a->param_addr); 154 free(a->param_addr);
155 free(a->addr); 155 free(a->addr);
156 if (a->bio_chain != NULL) 156 BIO_free(a->bio_chain);
157 BIO_free(a->bio_chain);
158 free(a); 157 free(a);
159} 158}
160 159
@@ -358,8 +357,7 @@ acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
358 } else if (num == 1) { 357 } else if (num == 1) {
359 data->accept_nbio = (ptr != NULL); 358 data->accept_nbio = (ptr != NULL);
360 } else if (num == 2) { 359 } else if (num == 2) {
361 if (data->bio_chain != NULL) 360 BIO_free(data->bio_chain);
362 BIO_free(data->bio_chain);
363 data->bio_chain = (BIO *)ptr; 361 data->bio_chain = (BIO *)ptr;
364 } 362 }
365 } 363 }
diff --git a/src/lib/libssl/src/crypto/cms/cms_lib.c b/src/lib/libssl/src/crypto/cms/cms_lib.c
index ee1f06c89a..4ca38e2428 100644
--- a/src/lib/libssl/src/crypto/cms/cms_lib.c
+++ b/src/lib/libssl/src/crypto/cms/cms_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_lib.c,v 1.3 2014/06/12 15:49:28 deraadt Exp $ */ 1/* $OpenBSD: cms_lib.c,v 1.4 2014/07/25 06:05:32 doug Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -360,8 +360,7 @@ cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm)
360 return mdbio; 360 return mdbio;
361 361
362err: 362err:
363 if (mdbio) 363 BIO_free(mdbio);
364 BIO_free(mdbio);
365 return NULL; 364 return NULL;
366} 365}
367 366
diff --git a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c
index c895e9df4d..5d1627192c 100644
--- a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c
+++ b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_ht.c,v 1.20 2014/07/12 14:58:32 miod Exp $ */ 1/* $OpenBSD: ocsp_ht.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -111,8 +111,7 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
111 if (rctx == NULL) 111 if (rctx == NULL)
112 return; 112 return;
113 113
114 if (rctx->mem) 114 BIO_free(rctx->mem);
115 BIO_free(rctx->mem);
116 free(rctx->iobuf); 115 free(rctx->iobuf);
117 free(rctx); 116 free(rctx);
118} 117}
diff --git a/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c b/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c
index cc6fd97b9d..8f1e393635 100644
--- a/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c
+++ b/src/lib/libssl/src/crypto/pkcs7/pk7_doit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_doit.c,v 1.28 2014/07/12 16:03:37 miod Exp $ */ 1/* $OpenBSD: pk7_doit.c,v 1.29 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -133,8 +133,7 @@ PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg)
133 return 1; 133 return 1;
134 134
135err: 135err:
136 if (btmp) 136 BIO_free(btmp);
137 BIO_free(btmp);
138 return 0; 137 return 0;
139 138
140} 139}
diff --git a/src/lib/libssl/src/crypto/x509/by_file.c b/src/lib/libssl/src/crypto/x509/by_file.c
index 10adcfbd77..04366460bb 100644
--- a/src/lib/libssl/src/crypto/x509/by_file.c
+++ b/src/lib/libssl/src/crypto/x509/by_file.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: by_file.c,v 1.15 2014/07/11 08:44:49 jsing Exp $ */ 1/* $OpenBSD: by_file.c,v 1.16 2014/07/25 06:05:32 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -182,8 +182,7 @@ X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type)
182err: 182err:
183 if (x != NULL) 183 if (x != NULL)
184 X509_free(x); 184 X509_free(x);
185 if (in != NULL) 185 BIO_free(in);
186 BIO_free(in);
187 return (ret); 186 return (ret);
188} 187}
189 188
@@ -243,8 +242,7 @@ X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type)
243err: 242err:
244 if (x != NULL) 243 if (x != NULL)
245 X509_CRL_free(x); 244 X509_CRL_free(x);
246 if (in != NULL) 245 BIO_free(in);
247 BIO_free(in);
248 return (ret); 246 return (ret);
249} 247}
250 248