From: Nikos Mavrogiannopoulos Date: Fri, 8 Apr 2011 15:17:24 +0000 (+0200) Subject: more leaks fixed in common.c X-Git-Tag: gnutls_2_99_0~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f248f64aa825cff8e7d08ffe79709200adcf6214;p=thirdparty%2Fgnutls.git more leaks fixed in common.c --- diff --git a/lib/x509/common.c b/lib/x509/common.c index 21774dfaee..51dc97aa04 100644 --- a/lib/x509/common.c +++ b/lib/x509/common.c @@ -1112,14 +1112,6 @@ _gnutls_x509_write_value (ASN1_TYPE c, const char *root, { /* Convert it to OCTET STRING */ - val.data = gnutls_malloc (asize); - if (val.data == NULL) - { - gnutls_assert (); - result = GNUTLS_E_MEMORY_ERROR; - goto cleanup; - } - if ((result = asn1_create_element (_gnutls_get_pkix (), "PKIX1.pkcs-7-Data", &c2)) != ASN1_SUCCESS) { @@ -1153,19 +1145,17 @@ _gnutls_x509_write_value (ASN1_TYPE c, const char *root, /* Write the data. */ result = asn1_write_value (c, root, val.data, val.size); - - if (val.data != data->data) - _gnutls_free_datum (&val); - if (result != ASN1_SUCCESS) { gnutls_assert (); - return _gnutls_asn2err (result); + result = _gnutls_asn2err (result); + goto cleanup; } - return 0; + result = 0; cleanup: + asn1_delete_structure (&c2); if (val.data != data->data) _gnutls_free_datum (&val); return result;