[sheepdog] [PATCH stable-0.7 2/3] farm: fix memory leak of slice.c

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


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

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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dog/farm/slice.c b/dog/farm/slice.c
index 53941c1..79fa859 100644
--- a/dog/farm/slice.c
+++ b/dog/farm/slice.c
@@ -101,9 +101,11 @@ void *slice_read(const unsigned char *sha1, size_t *outsize)
 
 	object = xmalloc(*outsize);
 	strbuf_copyout(&buf, object, *outsize);
+	free(file);
 	strbuf_release(&buf);
 	return object;
 err:
+	free(file);
 	strbuf_release(&buf);
 	return NULL;
 }
-- 
1.8.1.2




More information about the sheepdog mailing list