[sheepdog-users] [PATCH stable-0.8 19/22] sheep: fix memory leak in _invert_mat()

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Mon Feb 24 08:07:07 CET 2014


From: Robin Dong <sanbai at taobao.com>

First run swift interface on sheepdog, thean kill a node and wait for
recovery. After it, the RSS of sheep daemon will increase to about 8GB
which is a sign of memory leak.

Then we use valgrind to check sheepdog daemon and finally find out the
leak point: _invert_mat() in lib/fec.c

Signed-off-by: Robin DOng <sanbai at taobao.com>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 lib/fec.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/fec.c b/lib/fec.c
index 5d627f5..d19ad0c 100644
--- a/lib/fec.c
+++ b/lib/fec.c
@@ -366,6 +366,10 @@ found_piv:
 			for (row = 0; row < d; row++)
 				SWAP(src[row * d + indxr[col-1]],
 				     src[row * d + indxc[col-1]]);
+	free(indxc);
+	free(indxr);
+	free(ipiv);
+	free(id_row);
 }
 
 /*
-- 
1.7.10.4




More information about the sheepdog-users mailing list