ASN1err(ASN1_F_D2I_X509_NAME, ERR_R_MALLOC_FAILURE);
ASN1err(ASN1_F_X509_NAME_ENCODE, ERR_R_MALLOC_FAILURE);
static int x509_name_encode(X509_NAME *a){	STACK *intname = NULL, **intname_pp = &intname;	int len;	unsigned char *p;	STACK_OF(X509_NAME_ENTRY) *entries = NULL;	X509_NAME_ENTRY *entry;	int i, set = -1;	intname = sk_new_null();	if(!intname) goto memerr;	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {		entry = sk_X509_NAME_ENTRY_value(a->entries, i);		if(entry->set != set) {			entries = sk_X509_NAME_ENTRY_new_null();			if(!entries) goto memerr;			if(!sk_push(intname, (char *)entries)) goto memerr;			set = entry->set;		}		if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;	}	len = ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp, NULL,			       ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);	if (!BUF_MEM_grow(a->bytes,len)) goto memerr;	p=(unsigned char *)a->bytes->data;	ASN1_item_ex_i2d((ASN1_VALUE **)intname_pp,			 &p, ASN1_ITEM_rptr(X509_NAME_INTERNAL), -1, -1);	sk_pop_free(intname, sk_internal_free);	a->modified = 0;	return len;	memerr:	sk_pop_free(intname, sk_internal_free);	ASN1err(ASN1_F_D2I_X509_NAME, ERR_R_MALLOC_FAILURE);	return -1;}