Commit a15d3537bb52450f75ad63642b6bcbbcc6fdc374

Carlos Martín Nieto 2014-04-21T15:48:05

sysdir: free the path if we cannot find the file Returning an error cleared the buf, but this operation does not free the memory associated with it. Use git_buf_free() instead.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/sysdir.c b/src/sysdir.c
index 2e6304e..aebf231 100644
--- a/src/sysdir.c
+++ b/src/sysdir.c
@@ -213,7 +213,7 @@ static int git_sysdir_find_in_dirlist(
 			return 0;
 	}
 
-	git_buf_clear(path);
+	git_buf_free(path);
 	giterr_set(GITERR_OS, "The %s file '%s' doesn't exist", label, name);
 	return GIT_ENOTFOUND;
 }