From: David Mulder Date: Wed, 24 Oct 2018 16:55:02 +0000 (-0600) Subject: lib:socket: If returning early, set ifaces X-Git-Tag: tdb-1.3.17~1136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5391e21dea3168691cee1e6ef6c5959e46d62d1e;p=thirdparty%2Fsamba.git lib:socket: If returning early, set ifaces Prevents a segfault in load_interfaces() when total interfaces == 1. Fixes regression caused by da68a1b2f417ec82ea4ed3e7a4d867cef8ca8f93. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13665 Signed-off-by: David Mulder Reviewed-by: Ralph Böhme Reviewed-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Sun Oct 28 00:35:35 CEST 2018 on sn-devel-144 --- diff --git a/lib/socket/interfaces.c b/lib/socket/interfaces.c index 168bff501c2..ac26b97c248 100644 --- a/lib/socket/interfaces.c +++ b/lib/socket/interfaces.c @@ -363,12 +363,13 @@ static int iface_comp(struct iface_struct *i1, struct iface_struct *i2) 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; }