[sheepdog] [PATCH] farm: fix memory leak of slice_read()

Liu Yuan namei.unix at gmail.com
Wed Sep 25 17:36:17 CEST 2013


This is yet another leaker of slice_read.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 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.7.9.5




More information about the sheepdog mailing list