summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-08-04 07:50:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-08-04 16:31:57 (GMT)
commit398e659e1ec60501d67a0f3cb1a1052c6e50038c (patch)
tree4ae93fef031b805958b265679029177f547c3908 /revision.c
parentfd9a631c56ff326bea2956b675f205cd474def4e (diff)
downloadgit-398e659e1ec60501d67a0f3cb1a1052c6e50038c.zip
git-398e659e1ec60501d67a0f3cb1a1052c6e50038c.tar.gz
git-398e659e1ec60501d67a0f3cb1a1052c6e50038c.tar.bz2
revision: avoid leak when preparing bloom filter for "/"
If we're given an empty pathspec, we refuse to set up bloom filters, as described in f3c2a36810 (revision: empty pathspecs should not use Bloom filters, 2020-07-01). But before the empty string check, we drop any trailing slash by allocating a new string without it. So a pathspec consisting only of "/" will allocate that string, but then still cause us to bail, leaking the new string. Let's make sure to free it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index 5ed86e4..b808685 100644
--- a/revision.c
+++ b/revision.c
@@ -702,6 +702,7 @@ static void prepare_to_use_bloom_filter(struct rev_info *revs)
len = strlen(path);
if (!len) {
revs->bloom_filter_settings = NULL;
+ free(path_alloc);
return;
}