summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-01-02 12:03:08 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-01-02 12:03:08 -0600
commit7f55c940749ba58dff27df5a1d1d061ce332d101 (patch)
tree4db21aa9c7187618a23a8b7fed2b95292bfcd1f2
parentb9bc3662b15593dccfc4a75e68cf0bf6c51878ba (diff)
downloadnuttx-7f55c940749ba58dff27df5a1d1d061ce332d101.tar.gz
nuttx-7f55c940749ba58dff27df5a1d1d061ce332d101.tar.bz2
nuttx-7f55c940749ba58dff27df5a1d1d061ce332d101.zip
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).
-rw-r--r--nuttx/net/tcp/tcp_conn.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/nuttx/net/tcp/tcp_conn.c b/nuttx/net/tcp/tcp_conn.c
index d92923d0b..5209646b1 100644
--- a/nuttx/net/tcp/tcp_conn.c
+++ b/nuttx/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)