summaryrefslogtreecommitdiff
path: root/lib/libcrypto/x509
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-09-26 19:30:39 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-09-26 19:30:39 +0000
commit083ec692a956683308a802aac24344e73ee5e8fc (patch)
tree9e6e55118916c6fb846a3ac5930acaba7638e038 /lib/libcrypto/x509
parent2fbd9710d0d2bc42cba42ee5df11b6db13c6b086 (diff)
X509at_add1_attr(): do not free stuff we did not allocate in the error path.
ok tedu@
Diffstat (limited to 'lib/libcrypto/x509')
-rw-r--r--lib/libcrypto/x509/x509_att.c6
1 files changed, 3 insertions, 3 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);
}