[sheepdog] [PATCH] sheep: fix memory leak at create_client()
Ryusuke Konishi
konishi.ryusuke at lab.ntt.co.jp
Mon Dec 16 13:10:44 CET 2013
The current create_client function does not free client_info structure
when getpeername() failed.
This fixes the leak bug.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke at lab.ntt.co.jp>
---
sheep/request.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sheep/request.c b/sheep/request.c
index dfca8ee..97c95ae 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -744,8 +744,10 @@ static struct client_info *create_client(int fd, struct cluster_info *cluster)
if (!ci)
return NULL;
- if (getpeername(fd, (struct sockaddr *)&from, &namesize))
+ if (getpeername(fd, (struct sockaddr *)&from, &namesize)) {
+ free(ci);
return NULL;
+ }
switch (from.ss_family) {
case AF_INET:
--
1.7.9.3
More information about the sheepdog
mailing list