Commit a89d63a1 authored by Casey Dahlin's avatar Casey Dahlin Committed by David Teigland

dlm: free socket in error exit path

In the tcp_connect_to_sock() error exit path, the socket
allocated at the top of the function was not being freed.
Signed-off-by: default avatarCasey Dahlin <cdahlin@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent c78a87d0
...@@ -902,7 +902,7 @@ static void tcp_connect_to_sock(struct connection *con) ...@@ -902,7 +902,7 @@ static void tcp_connect_to_sock(struct connection *con)
int result = -EHOSTUNREACH; int result = -EHOSTUNREACH;
struct sockaddr_storage saddr, src_addr; struct sockaddr_storage saddr, src_addr;
int addr_len; int addr_len;
struct socket *sock; struct socket *sock = NULL;
if (con->nodeid == 0) { if (con->nodeid == 0) {
log_print("attempt to connect sock 0 foiled"); log_print("attempt to connect sock 0 foiled");
...@@ -962,6 +962,8 @@ static void tcp_connect_to_sock(struct connection *con) ...@@ -962,6 +962,8 @@ static void tcp_connect_to_sock(struct connection *con)
if (con->sock) { if (con->sock) {
sock_release(con->sock); sock_release(con->sock);
con->sock = NULL; con->sock = NULL;
} else if (sock) {
sock_release(sock);
} }
/* /*
* Some errors are fatal and this list might need adjusting. For other * Some errors are fatal and this list might need adjusting. For other
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment