If the second silc_stack_alloc fails, then asn1->stack2 is NULL. Thus,
when silc_asn1_init calls silc_stack_free(asn1->stack2), it is
equivalent to silc_stack_free(NULL). However, silc_stack_free does not
check for a NULL pointer. Fix silc_asn1_init to free asn1->stack1, as
was intended.
asn1->stack2 = silc_stack_alloc(768);
if (!asn1->stack2) {
- silc_stack_free(asn1->stack2);
+ silc_stack_free(asn1->stack1);
return FALSE;
}