[sheepdog] [PATCH stable-0.7 3/3] farm: fix memory leak of slice_read()

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Oct 7 16:48:11 CEST 2013


From: Liu Yuan <namei.unix at gmail.com>

This is yet another leaker of slice_read.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 dog/farm/slice.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dog/farm/slice.c b/dog/farm/slice.c
index 79fa859..77db771 100644
--- a/dog/farm/slice.c
+++ b/dog/farm/slice.c
@@ -96,6 +96,7 @@ void *slice_read(const unsigned char *sha1, size_t *outsize)
 		if (!sbuf)
 			goto err;
 		strbuf_add(&buf, sbuf, size);
+		free(sbuf);
 		*outsize += size;
 	}
 
-- 
1.8.1.2




More information about the sheepdog mailing list