[sheepdog] [PATCH 2/2] farm: fix memory leak of slice.c

Liu Yuan namei.unix at gmail.com
Tue Sep 24 19:43:28 CEST 2013


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




More information about the sheepdog mailing list