summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-01-03 16:10:07 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-01-03 16:14:18 +0100
commit23ee89acacaf7f06517c82f31ad9f3a958b0324c (patch)
treec4fbf9fd48631165f3dfd5c83ca59e29abaa6167
parenta789c413638669f2b1e36ebf8303746629f8bf27 (diff)
downloadgnutls-tmp-client-test-suite.tar.gz
gnutls_x509_ext_import_policies: fixed memory leak on error pathtmp-client-test-suite
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--lib/x509/x509_ext.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/x509/x509_ext.c b/lib/x509/x509_ext.c
index 2cbb684691..b947b46028 100644
--- a/lib/x509/x509_ext.c
+++ b/lib/x509/x509_ext.c
@@ -1706,8 +1706,9 @@ void gnutls_x509_policies_deinit(gnutls_x509_policies_t policies)
{
unsigned i;
- for (i = 0; i < policies->size; i++)
+ for (i = 0; i < policies->size; i++) {
gnutls_x509_policy_release(&policies->policy[i]);
+ }
gnutls_free(policies);
}
@@ -1846,7 +1847,7 @@ int gnutls_x509_ext_import_policies(const gnutls_datum_t * ext,
/* create a string like "?1"
*/
snprintf(tmpstr, sizeof(tmpstr), "?%u.policyIdentifier", j + 1);
- current = j;
+ current = j+1;
ret = _gnutls_x509_read_value(c2, tmpstr, &tmpd);
if (ret == GNUTLS_E_ASN1_ELEMENT_NOT_FOUND)
@@ -1876,7 +1877,7 @@ int gnutls_x509_ext_import_policies(const gnutls_datum_t * ext,
if (ret != ASN1_SUCCESS) {
gnutls_assert();
ret = _gnutls_asn2err(ret);
- goto cleanup;
+ goto full_cleanup;
}
if (strcmp(tmpoid, "1.3.6.1.5.5.7.2.1") == 0) {