diff options
author | beck <> | 2020-09-14 11:35:32 +0000 |
---|---|---|
committer | beck <> | 2020-09-14 11:35:32 +0000 |
commit | c294f416edb87b3e8d1d37f8bc38d74850ef8d6b (patch) | |
tree | 7c0b69f4cdadcb1a9ae4ccf2e0036883d6fbffda | |
parent | 4bbf4bdcaa58f7f8048f9ee4d05a44ad489b546c (diff) | |
download | openbsd-c294f416edb87b3e8d1d37f8bc38d74850ef8d6b.tar.gz openbsd-c294f416edb87b3e8d1d37f8bc38d74850ef8d6b.tar.bz2 openbsd-c294f416edb87b3e8d1d37f8bc38d74850ef8d6b.zip |
Fix potential leak when tmpext fails to be added to
the extension list.
found by llvm static analyzer
ok tb@
-rw-r--r-- | src/lib/libcrypto/x509/x509_lib.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_lib.c b/src/lib/libcrypto/x509/x509_lib.c index 3af090fde6..211d0adfee 100644 --- a/src/lib/libcrypto/x509/x509_lib.c +++ b/src/lib/libcrypto/x509/x509_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_lib.c,v 1.1 2020/06/04 15:19:31 jsing Exp $ */ | 1 | /* $OpenBSD: x509_lib.c,v 1.2 2020/09/14 11:35:32 beck 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 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -168,7 +168,11 @@ X509V3_EXT_add_alias(int nid_to, int nid_from) | |||
168 | *tmpext = *ext; | 168 | *tmpext = *ext; |
169 | tmpext->ext_nid = nid_to; | 169 | tmpext->ext_nid = nid_to; |
170 | tmpext->ext_flags |= X509V3_EXT_DYNAMIC; | 170 | tmpext->ext_flags |= X509V3_EXT_DYNAMIC; |
171 | return X509V3_EXT_add(tmpext); | 171 | if (!X509V3_EXT_add(tmpext)) { |
172 | free(tmpext); | ||
173 | return 0; | ||
174 | } | ||
175 | return 1; | ||
172 | } | 176 | } |
173 | 177 | ||
174 | void | 178 | void |