summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-03-14 16:45:46 -0700
committerRussell Belfer <rb@github.com>2014-04-17 14:43:46 -0700
commitcef170abf2704a3e3aa109020f7041e43b5e4f71 (patch)
treec5f12776b066e8ecd50a5e42288b91247acf0dcb
parentb87776151ad40caaec8bfe1becec4db429c9ea96 (diff)
downloadlibgit2-cef170abf2704a3e3aa109020f7041e43b5e4f71.tar.gz
Fix leak when using push and pop with ignores
The iterator pushes and pops ignores incrementally onto a list as it traverses the directory structure so that it doesn't have to constantly recheck which ignore files apply. With the new ref counting, it wasn't decrementing the refcount on the ignores that it removed from the vector.
-rw-r--r--src/ignore.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ignore.c b/src/ignore.c
index 9b3c6a8bc..0fb042a34 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -191,7 +191,10 @@ int git_ignore__pop_dir(git_ignores *ign)
if (ign->dir.size >= keylen &&
!memcmp(ign->dir.ptr + ign->dir.size - keylen, start, keylen))
+ {
+ git_attr_file__free(git_vector_last(&ign->ign_path));
git_vector_pop(&ign->ign_path);
+ }
}
if (--ign->depth > 0) {