{
/* 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)
{
/* 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;