threads / patch / 11313

patchFix a memory leak

Subject: [PATCH] Fix a memory leak

## tl;dr

One message between Dec 16, 2007 and Dec 16, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

李鸿· Dec 16, 2007, 04:53 UTC · lore
Signed-off-by: Li Hong <leehong@pku.edu.cn>
---
 dir.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Show changes to dir.c +3 −0
diff --git a/dir.c b/dir.c
index 6b3273d..3e345c2 100644
--- a/dir.c
+++ b/dir.c
@@ -169,7 +169,10 @@ static int add_excludes_from_file_1(const char *fname,
 	}
 	buf = xmalloc(size+1);
 	if (read_in_full(fd, buf, size) != size)
+	{
+		free(buf);
 		goto err;
+	}
 	close(fd);
 
 	if (buf_p)
-- 
1.5.4.rc0.8.gaba5e

← back to recent threads