diff options
| author | jsing <> | 2018-02-07 04:25:19 +0000 |
|---|---|---|
| committer | jsing <> | 2018-02-07 04:25:19 +0000 |
| commit | 91513e7059067d6b8438c18b4a274825340acad0 (patch) | |
| tree | f87a7679e39011d2ce6ac269bc9711d690067d2f | |
| parent | 766b2a8db8a962a03b684be3949e366b7a8553e0 (diff) | |
| download | openbsd-91513e7059067d6b8438c18b4a274825340acad0.tar.gz openbsd-91513e7059067d6b8438c18b4a274825340acad0.tar.bz2 openbsd-91513e7059067d6b8438c18b4a274825340acad0.zip | |
Remove guards around *_free() calls since these functions handle NULL.
| -rw-r--r-- | src/usr.bin/openssl/apps.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c index a63bbf9c13..2dab036b32 100644 --- a/src/usr.bin/openssl/apps.c +++ b/src/usr.bin/openssl/apps.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: apps.c,v 1.44 2017/08/12 21:04:33 jsing Exp $ */ | 1 | /* $OpenBSD: apps.c,v 1.45 2018/02/07 04:25:19 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -584,8 +584,7 @@ load_pkcs12(BIO *err, BIO *in, const char *desc, pem_password_cb *pem_cb, | |||
| 584 | ret = PKCS12_parse(p12, pass, pkey, cert, ca); | 584 | ret = PKCS12_parse(p12, pass, pkey, cert, ca); |
| 585 | 585 | ||
| 586 | die: | 586 | die: |
| 587 | if (p12) | 587 | PKCS12_free(p12); |
| 588 | PKCS12_free(p12); | ||
| 589 | return ret; | 588 | return ret; |
| 590 | } | 589 | } |
| 591 | 590 | ||
| @@ -900,8 +899,7 @@ load_certs_crls(BIO *err, const char *file, int format, const char *pass, | |||
| 900 | rv = 1; | 899 | rv = 1; |
| 901 | 900 | ||
| 902 | end: | 901 | end: |
| 903 | if (xis) | 902 | sk_X509_INFO_pop_free(xis, X509_INFO_free); |
| 904 | sk_X509_INFO_pop_free(xis, X509_INFO_free); | ||
| 905 | 903 | ||
| 906 | if (rv == 0) { | 904 | if (rv == 0) { |
| 907 | if (pcerts) { | 905 | if (pcerts) { |
| @@ -1311,10 +1309,8 @@ load_serial(char *serialfile, int create, ASN1_INTEGER **retai) | |||
| 1311 | } | 1309 | } |
| 1312 | 1310 | ||
| 1313 | err: | 1311 | err: |
| 1314 | if (in != NULL) | 1312 | BIO_free(in); |
| 1315 | BIO_free(in); | 1313 | ASN1_INTEGER_free(ai); |
| 1316 | if (ai != NULL) | ||
| 1317 | ASN1_INTEGER_free(ai); | ||
| 1318 | return (ret); | 1314 | return (ret); |
| 1319 | } | 1315 | } |
| 1320 | 1316 | ||
| @@ -1359,10 +1355,8 @@ save_serial(char *serialfile, char *suffix, BIGNUM *serial, | |||
| 1359 | } | 1355 | } |
| 1360 | 1356 | ||
| 1361 | err: | 1357 | err: |
| 1362 | if (out != NULL) | 1358 | BIO_free_all(out); |
| 1363 | BIO_free_all(out); | 1359 | ASN1_INTEGER_free(ai); |
| 1364 | if (ai != NULL) | ||
| 1365 | ASN1_INTEGER_free(ai); | ||
| 1366 | return (ret); | 1360 | return (ret); |
| 1367 | } | 1361 | } |
| 1368 | 1362 | ||
| @@ -1431,8 +1425,7 @@ rand_serial(BIGNUM *b, ASN1_INTEGER *ai) | |||
| 1431 | ret = 1; | 1425 | ret = 1; |
| 1432 | 1426 | ||
| 1433 | error: | 1427 | error: |
| 1434 | if (!b) | 1428 | BN_free(btmp); |
| 1435 | BN_free(btmp); | ||
| 1436 | 1429 | ||
| 1437 | return ret; | 1430 | return ret; |
| 1438 | } | 1431 | } |
| @@ -1497,12 +1490,9 @@ load_index(char *dbfile, DB_ATTR *db_attr) | |||
| 1497 | } | 1490 | } |
| 1498 | 1491 | ||
| 1499 | err: | 1492 | err: |
| 1500 | if (dbattr_conf) | 1493 | NCONF_free(dbattr_conf); |
| 1501 | NCONF_free(dbattr_conf); | 1494 | TXT_DB_free(tmpdb); |
| 1502 | if (tmpdb) | 1495 | BIO_free_all(in); |
| 1503 | TXT_DB_free(tmpdb); | ||
| 1504 | if (in) | ||
| 1505 | BIO_free_all(in); | ||
| 1506 | return retdb; | 1496 | return retdb; |
| 1507 | } | 1497 | } |
| 1508 | 1498 | ||
| @@ -1675,8 +1665,7 @@ void | |||
| 1675 | free_index(CA_DB *db) | 1665 | free_index(CA_DB *db) |
| 1676 | { | 1666 | { |
| 1677 | if (db) { | 1667 | if (db) { |
| 1678 | if (db->db) | 1668 | TXT_DB_free(db->db); |
| 1679 | TXT_DB_free(db->db); | ||
| 1680 | free(db); | 1669 | free(db); |
| 1681 | } | 1670 | } |
| 1682 | } | 1671 | } |
| @@ -1945,8 +1934,7 @@ args_verify(char ***pargs, int *pargc, int *badarg, BIO *err, | |||
| 1945 | return 0; | 1934 | return 0; |
| 1946 | 1935 | ||
| 1947 | if (*badarg) { | 1936 | if (*badarg) { |
| 1948 | if (*pm) | 1937 | X509_VERIFY_PARAM_free(*pm); |
| 1949 | X509_VERIFY_PARAM_free(*pm); | ||
| 1950 | *pm = NULL; | 1938 | *pm = NULL; |
| 1951 | goto end; | 1939 | goto end; |
| 1952 | } | 1940 | } |
| @@ -2075,8 +2063,8 @@ policies_print(BIO *out, X509_STORE_CTX *ctx) | |||
| 2075 | 2063 | ||
| 2076 | nodes_print(out, "Authority", X509_policy_tree_get0_policies(tree)); | 2064 | nodes_print(out, "Authority", X509_policy_tree_get0_policies(tree)); |
| 2077 | nodes_print(out, "User", X509_policy_tree_get0_user_policies(tree)); | 2065 | nodes_print(out, "User", X509_policy_tree_get0_user_policies(tree)); |
| 2078 | if (free_out) | 2066 | |
| 2079 | BIO_free(out); | 2067 | BIO_free(out); |
| 2080 | } | 2068 | } |
| 2081 | 2069 | ||
| 2082 | /* | 2070 | /* |
