From a6a9452c05aadbbd693f51395b4c80ccbfcde7df Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 2 Jan 2015 12:03:08 -0600 Subject: [PATCH] net/tcp/tcp_conn.c: Fix a logic error when CONFIG_NETDEV_MULTINIC is selected: net_unlock(flags) will be called will an uninitialized variable (2015-01-03). --- net/tcp/tcp_conn.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c index d92923d0bd..5209646b16 100644 --- a/net/tcp/tcp_conn.c +++ b/net/tcp/tcp_conn.c @@ -651,10 +651,13 @@ int tcp_bind(FAR struct tcp_conn_s *conn, int port; #ifdef CONFIG_NETDEV_MULTINIC net_ipaddr_t ipaddr; +#endif /* Verify or select a local port and address */ flags = net_lock(); + +#ifdef CONFIG_NETDEV_MULTINIC #ifdef CONFIG_NET_IPv6 /* Get the IPv6 address that we are binding to */ @@ -673,6 +676,7 @@ int tcp_bind(FAR struct tcp_conn_s *conn, port = tcp_selectport(ntohs(addr->sin_port)); #endif + net_unlock(flags); if (port < 0)