summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2015-02-13 01:16:27 +0000
committerBob Beck <beck@cvs.openbsd.org>2015-02-13 01:16:27 +0000
commit4ca20bf0887c2ff10798d99e93a19b512d1f6623 (patch)
tree52e3af5711108498222b5a2d3ba53d5ebe980711 /lib
parent0eae9da9593ac4056b4a1a0330f6465edd97ca5f (diff)
Don't leak memory on errors - fixes coverity issues 105353 105253
ok guenther@ jsg@
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/crypto/x509v3/v3_pmaps.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/libssl/src/crypto/x509v3/v3_pmaps.c b/lib/libssl/src/crypto/x509v3/v3_pmaps.c
index 84c105892d0..e8099d7f12c 100644
--- a/lib/libssl/src/crypto/x509v3/v3_pmaps.c
+++ b/lib/libssl/src/crypto/x509v3/v3_pmaps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v3_pmaps.c,v 1.6 2015/02/10 05:43:09 jsing Exp $ */
+/* $OpenBSD: v3_pmaps.c,v 1.7 2015/02/13 01:16:26 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
@@ -126,9 +126,9 @@ static void *
v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
STACK_OF(CONF_VALUE) *nval)
{
- POLICY_MAPPINGS *pmaps;
- POLICY_MAPPING *pmap;
- ASN1_OBJECT *obj1, *obj2;
+ POLICY_MAPPINGS *pmaps = NULL;
+ POLICY_MAPPING *pmap = NULL;
+ ASN1_OBJECT *obj1 = NULL, *obj2 = NULL;
CONF_VALUE *val;
int i, rc;
@@ -156,10 +156,12 @@ v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
}
pmap->issuerDomainPolicy = obj1;
pmap->subjectDomainPolicy = obj2;
+ obj1 = obj2 = NULL;
if (sk_POLICY_MAPPING_push(pmaps, pmap) == 0) {
rc = ERR_R_MALLOC_FAILURE;
goto err;
}
+ pmap = NULL;
}
return pmaps;
@@ -168,5 +170,8 @@ err:
X509V3err(X509V3_F_V2I_POLICY_MAPPINGS, rc);
if (rc == X509V3_R_INVALID_OBJECT_IDENTIFIER)
X509V3_conf_err(val);
+ ASN1_OBJECT_free(obj1);
+ ASN1_OBJECT_free(obj2);
+ POLICY_MAPPING_free(pmap);
return NULL;
}