diff options
author | Kinichiro Inoguchi <inoguchi@cvs.openbsd.org> | 2021-04-07 10:29:59 +0000 |
---|---|---|
committer | Kinichiro Inoguchi <inoguchi@cvs.openbsd.org> | 2021-04-07 10:29:59 +0000 |
commit | 8830ea73f205621d08f2f6c0f16b2270a0d978ef (patch) | |
tree | eb8090b8ad1204dcf1c8362371a5d086037ac6fa /usr.bin | |
parent | 7ef1c1053c9eec7175509b2ddc0a2735ebda0c2c (diff) |
Avoid leak in error path
ok and input from tb@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/openssl/x509.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/openssl/x509.c b/usr.bin/openssl/x509.c index 8651c317c06..4d497851ca7 100644 --- a/usr.bin/openssl/x509.c +++ b/usr.bin/openssl/x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509.c,v 1.21 2021/04/01 10:47:38 inoguchi Exp $ */ +/* $OpenBSD: x509.c,v 1.22 2021/04/07 10:29:58 inoguchi Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -977,11 +977,15 @@ x509_main(int argc, char **argv) bnser = ASN1_INTEGER_to_BN(ser, NULL); if (bnser == NULL) goto end; - if (!BN_add_word(bnser, 1)) + if (!BN_add_word(bnser, 1)) { + BN_free(bnser); goto end; + } ser = BN_to_ASN1_INTEGER(bnser, NULL); - if (ser == NULL) + if (ser == NULL) { + BN_free(bnser); goto end; + } BN_free(bnser); i2a_ASN1_INTEGER(out, ser); ASN1_INTEGER_free(ser); |