diff options
author | Kinichiro Inoguchi <inoguchi@cvs.openbsd.org> | 2021-08-30 12:25:55 +0000 |
---|---|---|
committer | Kinichiro Inoguchi <inoguchi@cvs.openbsd.org> | 2021-08-30 12:25:55 +0000 |
commit | 0ebe3b29441b0be3ddc54e3f89acb9bfa10d53e9 (patch) | |
tree | 1fb7be66afe8bab6992d2841db48825797f81d13 | |
parent | 378c6cbc25c2f52ab895d53157bd100ab8a9bb86 (diff) |
Clean up end of do_body in openssl(1) ca
suggested from tb@
-rw-r--r-- | usr.bin/openssl/ca.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/openssl/ca.c b/usr.bin/openssl/ca.c index b3c2b316634..1c383d40af0 100644 --- a/usr.bin/openssl/ca.c +++ b/usr.bin/openssl/ca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ca.c,v 1.42 2021/08/30 12:12:11 inoguchi Exp $ */ +/* $OpenBSD: ca.c,v 1.43 2021/08/30 12:25:54 inoguchi Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1745,6 +1745,8 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, OPENSSL_STRING *irow = NULL; OPENSSL_STRING *rrow = NULL; + *xret = NULL; + tmptm = ASN1_UTCTIME_new(); if (tmptm == NULL) { BIO_printf(bio_err, "malloc error\n"); @@ -2275,7 +2277,11 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); goto err; } + + *xret = ret; + ret = NULL; ok = 1; + err: for (i = 0; i < DB_NUMBER; i++) free(row[i]); @@ -2285,11 +2291,7 @@ do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, if (!email_dn) X509_NAME_free(dn_subject); ASN1_UTCTIME_free(tmptm); - if (ok <= 0) { - X509_free(ret); - ret = NULL; - } else - *xret = ret; + X509_free(ret); return (ok); } |