]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From a89d63a159b1ba5833be2bef00adf8ad8caac8be Mon Sep 17 00:00:00 2001 |
2 | From: Casey Dahlin <cdahlin@redhat.com> | |
3 | Date: Tue, 14 Jul 2009 12:17:51 -0500 | |
4 | Subject: [PATCH] dlm: free socket in error exit path | |
5 | ||
6 | In the tcp_connect_to_sock() error exit path, the socket | |
7 | allocated at the top of the function was not being freed. | |
8 | ||
9 | Signed-off-by: Casey Dahlin <cdahlin@redhat.com> | |
10 | Signed-off-by: David Teigland <teigland@redhat.com> | |
11 | Signed-off-by: Coly Li <coly.li@suse.de> | |
12 | --- | |
13 | fs/dlm/lowcomms.c | 4 +++- | |
14 | 1 files changed, 3 insertions(+), 1 deletions(-) | |
15 | ||
16 | diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c | |
17 | index cdb580a..618a60f 100644 | |
18 | --- a/fs/dlm/lowcomms.c | |
19 | +++ b/fs/dlm/lowcomms.c | |
20 | @@ -902,7 +902,7 @@ static void tcp_connect_to_sock(struct connection *con) | |
21 | int result = -EHOSTUNREACH; | |
22 | struct sockaddr_storage saddr, src_addr; | |
23 | int addr_len; | |
24 | - struct socket *sock; | |
25 | + struct socket *sock = NULL; | |
26 | ||
27 | if (con->nodeid == 0) { | |
28 | log_print("attempt to connect sock 0 foiled"); | |
29 | @@ -962,6 +962,8 @@ out_err: | |
30 | if (con->sock) { | |
31 | sock_release(con->sock); | |
32 | con->sock = NULL; | |
33 | + } else if (sock) { | |
34 | + sock_release(sock); | |
35 | } | |
36 | /* | |
37 | * Some errors are fatal and this list might need adjusting. For other | |
38 | -- | |
39 | 1.6.0.2 | |
40 |