[sheepdog] [PATCH v2 1/2] sheep: fix memory leak in _invert_mat()

Robin Dong robin.k.dong at gmail.com
Thu Feb 13 11:16:58 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>
---
 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.12.4




More information about the sheepdog mailing list