[sheepdog] [PATCH v1 1/2] sheepfs: fix memory leak in object_create_entry()

Robin Dong robin.k.dong at gmail.com
Thu Mar 6 07:10:36 CET 2014


From: Robin Dong <sanbai at taobao.com>

We should free all args after using split_path().

Signed-off-by: Robin Dong <sanbai at taobao.com>
---
 sheepfs/http.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sheepfs/http.c b/sheepfs/http.c
index 2ff3cbe..50c0a82 100644
--- a/sheepfs/http.c
+++ b/sheepfs/http.c
@@ -327,6 +327,8 @@ static int object_create_entry(const char *entry, const char *url)
 	}
 	ret = 0;
 out:
+	for (int i = 0; i < ARRAY_SIZE(args); i++)
+		free(args[i]);
 	strbuf_release(&buf);
 	return ret;
 }
-- 
1.7.12.4




More information about the sheepdog mailing list