summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-11 21:07:16 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-01-11 23:21:46 -0800
commit1dbcc9fc4e6f5264d5bb46f6d7f744eb4a4063e4 (patch)
treec6ab4917dcb9814569e8c2a7423c0034996c9f9a /src/path.c
parent0cfcff5daac50d5a4ba41d5125b108cdfceed832 (diff)
downloadlibgit2-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/path.c')
-rw-r--r--src/path.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/path.c b/src/path.c
index 4888123bf..03ebfe090 100644
--- a/src/path.c
+++ b/src/path.c
@@ -329,6 +329,7 @@ int git_path_walk_up(
iter.ptr = path->ptr;
iter.size = path->size;
+ iter.asize = path->asize;
while (scan >= stop) {
if ((error = cb(data, &iter)) < GIT_SUCCESS)
@@ -343,7 +344,8 @@ int git_path_walk_up(
}
}
- iter.ptr[scan] = oldc;
+ if (scan >= 0)
+ iter.ptr[scan] = oldc;
return error;
}