Mark Wielaard <[email protected]> writes:

> -      Dwarf_Attribute attributes[proto->nforms];
> +      Dwarf_Attribute *attributes;
> +      Dwarf_Attribute *attributesp = NULL;
> +      Dwarf_Attribute nattributes[8];
> +      if (unlikely (proto->nforms > 8))
> +     {
> +       attributesp = malloc (sizeof (Dwarf_Attribute) * proto->nforms);
> +       if (attributesp == NULL)
> +         {
> +           __libdw_seterrno (DWARF_E_NOMEM);
> +           return -1;
> +         }
> +       attributes = attributesp;
> +     }
> +      else
> +     attributes = &nattributes[0];
> +
>        for (Dwarf_Word i = 0; i < proto->nforms; ++i)
>       {

There's a return in this loop that needs free (attributesp) as well.

Thanks,
Petr

Reply via email to