diff options
author | 2014-09-26 19:30:38 +0000 | |
---|---|---|
committer | 2014-09-26 19:30:38 +0000 | |
commit | 55d685b3a7125349c1605e6720246c94fab11c2f (patch) | |
tree | 24288c36c8d0c164b2090e09c94278bc2a8dd54c | |
parent | make the default of the "Change the default console" question depend (diff) | |
download | wireguard-openbsd-55d685b3a7125349c1605e6720246c94fab11c2f.tar.xz wireguard-openbsd-55d685b3a7125349c1605e6720246c94fab11c2f.zip |
X509at_add1_attr(): do not free stuff we did not allocate in the error path.
ok tedu@
-rw-r--r-- | lib/libcrypto/x509/x509_att.c | 6 | ||||
-rw-r--r-- | lib/libssl/src/crypto/x509/x509_att.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/libcrypto/x509/x509_att.c b/lib/libcrypto/x509/x509_att.c index 4ae7504caef..e3acc18ed14 100644 --- a/lib/libcrypto/x509/x509_att.c +++ b/lib/libcrypto/x509/x509_att.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_att.c,v 1.11 2014/07/11 08:44:49 jsing Exp $ */ +/* $OpenBSD: x509_att.c,v 1.12 2014/09/26 19:30:38 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -140,7 +140,7 @@ X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, X509_ATTRIBUTE *attr) if ((sk = sk_X509_ATTRIBUTE_new_null()) == NULL) goto err; } else - sk= *x; + sk = *x; if ((new_attr = X509_ATTRIBUTE_dup(attr)) == NULL) goto err2; @@ -155,7 +155,7 @@ err: err2: if (new_attr != NULL) X509_ATTRIBUTE_free(new_attr); - if (sk != NULL) + if (sk != NULL && sk != *x) sk_X509_ATTRIBUTE_free(sk); return (NULL); } diff --git a/lib/libssl/src/crypto/x509/x509_att.c b/lib/libssl/src/crypto/x509/x509_att.c index 4ae7504caef..e3acc18ed14 100644 --- a/lib/libssl/src/crypto/x509/x509_att.c +++ b/lib/libssl/src/crypto/x509/x509_att.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_att.c,v 1.11 2014/07/11 08:44:49 jsing Exp $ */ +/* $OpenBSD: x509_att.c,v 1.12 2014/09/26 19:30:38 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -140,7 +140,7 @@ X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, X509_ATTRIBUTE *attr) if ((sk = sk_X509_ATTRIBUTE_new_null()) == NULL) goto err; } else - sk= *x; + sk = *x; if ((new_attr = X509_ATTRIBUTE_dup(attr)) == NULL) goto err2; @@ -155,7 +155,7 @@ err: err2: if (new_attr != NULL) X509_ATTRIBUTE_free(new_attr); - if (sk != NULL) + if (sk != NULL && sk != *x) sk_X509_ATTRIBUTE_free(sk); return (NULL); } |