diff options
author | 2020-09-14 11:35:32 +0000 | |
---|---|---|
committer | 2020-09-14 11:35:32 +0000 | |
commit | 594937660a36a61c991da10e4d9f91c8e1cdb9d0 (patch) | |
tree | b2491a935b0cfcab94f1ddbb50915db2eb6b5b50 /lib/libcrypto/x509/x509_lib.c | |
parent | Rewrite the agentx code of relayd. This new framework should allow us (diff) | |
download | wireguard-openbsd-594937660a36a61c991da10e4d9f91c8e1cdb9d0.tar.xz wireguard-openbsd-594937660a36a61c991da10e4d9f91c8e1cdb9d0.zip |
Fix potential leak when tmpext fails to be added to
the extension list.
found by llvm static analyzer
ok tb@
Diffstat (limited to 'lib/libcrypto/x509/x509_lib.c')
-rw-r--r-- | lib/libcrypto/x509/x509_lib.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libcrypto/x509/x509_lib.c b/lib/libcrypto/x509/x509_lib.c index 3af090fde66..211d0adfeec 100644 --- a/lib/libcrypto/x509/x509_lib.c +++ b/lib/libcrypto/x509/x509_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_lib.c,v 1.1 2020/06/04 15:19:31 jsing Exp $ */ +/* $OpenBSD: x509_lib.c,v 1.2 2020/09/14 11:35:32 beck Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -168,7 +168,11 @@ X509V3_EXT_add_alias(int nid_to, int nid_from) *tmpext = *ext; tmpext->ext_nid = nid_to; tmpext->ext_flags |= X509V3_EXT_DYNAMIC; - return X509V3_EXT_add(tmpext); + if (!X509V3_EXT_add(tmpext)) { + free(tmpext); + return 0; + } + return 1; } void |