提交 aceedfe3 编写于 作者: I Ingo Molnar 提交者: Petr Baudis

[patch] git: fix memory leak #2 in checkout-cache.c

this patch fixes another (very rare) memory leak in checkout-cache.
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NPetr Baudis <pasky@ucw.cz>
上级 06cd3b94
...@@ -77,6 +77,8 @@ static int write_entry(struct cache_entry *ce, const char *path) ...@@ -77,6 +77,8 @@ static int write_entry(struct cache_entry *ce, const char *path)
new = read_sha1_file(ce->sha1, type, &size); new = read_sha1_file(ce->sha1, type, &size);
if (!new || strcmp(type, "blob")) { if (!new || strcmp(type, "blob")) {
if (new)
free(new);
return error("checkout-cache: unable to read sha1 file of %s (%s)", return error("checkout-cache: unable to read sha1 file of %s (%s)",
path, sha1_to_hex(ce->sha1)); path, sha1_to_hex(ce->sha1));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册