asn1: Fix leak in der_copy_octet_string()
This manifested as a leak via _save fields in the template backend.
This commit is contained in:
@@ -149,8 +149,12 @@ int ASN1CALL
|
||||
der_copy_octet_string (const heim_octet_string *from, heim_octet_string *to)
|
||||
{
|
||||
to->length = from->length;
|
||||
to->data = malloc(to->length);
|
||||
if(to->length != 0 && to->data == NULL)
|
||||
if (from->data == NULL) {
|
||||
to->data = NULL;
|
||||
return 0;
|
||||
}
|
||||
to->data = malloc(to->length);
|
||||
if (to->length != 0 && to->data == NULL)
|
||||
return ENOMEM;
|
||||
memcpy(to->data, from->data, to->length);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user