diff options
author | Russell Belfer <arrbee@arrbee.com> | 2012-01-11 21:07:16 -0800 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2012-01-11 23:21:46 -0800 |
commit | 1dbcc9fc4e6f5264d5bb46f6d7f744eb4a4063e4 (patch) | |
tree | c6ab4917dcb9814569e8c2a7423c0034996c9f9a /src/ignore.c | |
parent | 0cfcff5daac50d5a4ba41d5125b108cdfceed832 (diff) | |
download | libgit2-1dbcc9fc4e6f5264d5bb46f6d7f744eb4a4063e4.tar.gz |
Fix several memory issues
This contains fixes for several issues discovered by MSVC and
by valgrind, including some bad data access, some memory
leakage (in where certain files were not being successfully
added to the cache), and some code simplification.
Diffstat (limited to 'src/ignore.c')
-rw-r--r-- | src/ignore.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ignore.c b/src/ignore.c index fa71d4941..cdc3edab6 100644 --- a/src/ignore.c +++ b/src/ignore.c @@ -23,6 +23,8 @@ static int load_ignore_file( if ((error = git_futils_readbuffer(&fbuf, path)) == GIT_SUCCESS) error = git_attr_file__new(&ignores); + ignores->path = git__strdup(path); + scan = fbuf.data; while (error == GIT_SUCCESS && *scan) { @@ -49,10 +51,10 @@ static int load_ignore_file( } git_futils_freebuffer(&fbuf); + git__free(match); if (error != GIT_SUCCESS) { git__rethrow(error, "Could not open ignore file '%s'", path); - git__free(match); git_attr_file__free(ignores); } else { *out = ignores; |