[PATCH] get_interfaces() return early causes segfault in winbind

Jeremy Allison jra at samba.org
Fri Oct 26 20:29:15 UTC 2018


On Thu, Oct 25, 2018 at 12:46:34PM -0600, David Mulder via samba-technical wrote:
> How about this instead:
> 
>     above */
>  int get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces)
>  {
> -       struct iface_struct *ifaces;
> +       struct iface_struct *ifaces = NULL;
>         int total, i, j;
>  
>         total = _get_interfaces(mem_ctx, &ifaces);
>         /* If we have an error, no interface or just one we can leave */
>         if (total <= 1) {
> +               *pifaces = ifaces;
>                 return total;
>         }
>  
> Initialize ifaces to NULL, then always set pifaces to ifaces? The
> initialization is necessary since _get_interfaces() returns without
> changing ifaces if there are no interfaces.

LGTM. RB+ and pushed (with addition of bug ref URL).

Jeremy.



More information about the samba-technical mailing list