From 6f166ec0c93aa2af2b8d8c02f91a997fb8b6d5fc Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Fri, 7 Feb 2014 14:11:18 +0200 Subject: [PATCH] bnep: Calculate ifindex after NULL check --- profiles/network/bnep.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c index 1aa078311..ece979fe6 100644 --- a/profiles/network/bnep.c +++ b/profiles/network/bnep.c @@ -523,13 +523,15 @@ static int bnep_add_to_bridge(const char *devname, const char *bridge) static int bnep_del_from_bridge(const char *devname, const char *bridge) { - int ifindex = if_nametoindex(devname); + int ifindex; struct ifreq ifr; int sk, err; if (!devname || !bridge) return -EINVAL; + ifindex = if_nametoindex(devname); + sk = socket(AF_INET, SOCK_STREAM, 0); if (sk < 0) return -1; -- 2.47.3