Skip to content

Commit

Permalink
dlm: free socket in error exit path
Browse files Browse the repository at this point in the history
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: Casey Dahlin <cdahlin@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
  • Loading branch information
Casey Dahlin authored and David Teigland committed Jul 14, 2009
1 parent c78a87d commit a89d63a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/dlm/lowcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ static void tcp_connect_to_sock(struct connection *con)
int result = -EHOSTUNREACH;
struct sockaddr_storage saddr, src_addr;
int addr_len;
struct socket *sock;
struct socket *sock = NULL;

if (con->nodeid == 0) {
log_print("attempt to connect sock 0 foiled");
Expand Down Expand Up @@ -962,6 +962,8 @@ static void tcp_connect_to_sock(struct connection *con)
if (con->sock) {
sock_release(con->sock);
con->sock = NULL;
} else if (sock) {
sock_release(sock);
}
/*
* Some errors are fatal and this list might need adjusting. For other
Expand Down

0 comments on commit a89d63a

Please sign in to comment.