summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2011-04-08 17:17:24 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2011-04-08 17:38:04 +0200
commit866c0cd1d76864f12e0a238fcf52d38bbf1b64ef (patch)
tree49fb598ce9622004c39cf158c49e81f130414786
parentcac89ca4d2dd56d2c7cd289ee6956ecf4570dc6b (diff)
downloadgnutls-866c0cd1d76864f12e0a238fcf52d38bbf1b64ef.tar.gz
more leaks fixed in common.c
-rw-r--r--lib/x509/common.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c
index 5119cbedac..80af4a0168 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;