summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorinoguchi <>2021-04-07 10:29:58 +0000
committerinoguchi <>2021-04-07 10:29:58 +0000
commit88100b565559b1d56606a0d129c09015e3a9ffc5 (patch)
tree46a3cfbab5c8970039a7a9851aaded08d4721b4d /src
parentba8f6ec6a0be9ecb7bc081995971a4e68261f3a7 (diff)
downloadopenbsd-88100b565559b1d56606a0d129c09015e3a9ffc5.tar.gz
openbsd-88100b565559b1d56606a0d129c09015e3a9ffc5.tar.bz2
openbsd-88100b565559b1d56606a0d129c09015e3a9ffc5.zip
Avoid leak in error path
ok and input from tb@
Diffstat (limited to 'src')
-rw-r--r--src/usr.bin/openssl/x509.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/usr.bin/openssl/x509.c b/src/usr.bin/openssl/x509.c
index 8651c317c0..4d497851ca 100644
--- a/src/usr.bin/openssl/x509.c
+++ b/src/usr.bin/openssl/x509.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509.c,v 1.21 2021/04/01 10:47:38 inoguchi Exp $ */ 1/* $OpenBSD: x509.c,v 1.22 2021/04/07 10:29:58 inoguchi 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 *
@@ -977,11 +977,15 @@ x509_main(int argc, char **argv)
977 bnser = ASN1_INTEGER_to_BN(ser, NULL); 977 bnser = ASN1_INTEGER_to_BN(ser, NULL);
978 if (bnser == NULL) 978 if (bnser == NULL)
979 goto end; 979 goto end;
980 if (!BN_add_word(bnser, 1)) 980 if (!BN_add_word(bnser, 1)) {
981 BN_free(bnser);
981 goto end; 982 goto end;
983 }
982 ser = BN_to_ASN1_INTEGER(bnser, NULL); 984 ser = BN_to_ASN1_INTEGER(bnser, NULL);
983 if (ser == NULL) 985 if (ser == NULL) {
986 BN_free(bnser);
984 goto end; 987 goto end;
988 }
985 BN_free(bnser); 989 BN_free(bnser);
986 i2a_ASN1_INTEGER(out, ser); 990 i2a_ASN1_INTEGER(out, ser);
987 ASN1_INTEGER_free(ser); 991 ASN1_INTEGER_free(ser);