summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2018-05-24 20:28:36 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2018-05-24 20:28:36 +0200
commit9e723db877f3c310f826f517ebe509722aad22eb (patch)
tree79042afcbc2d8ff8c81044845609e2c533d9e2db /src
parentc16ebaa6bd68d656e13c627f07920466846d5ab6 (diff)
downloadlibgit2-9e723db877f3c310f826f517ebe509722aad22eb.tar.gz
submodule: plug leaks from the escape detection
Diffstat (limited to 'src')
-rw-r--r--src/submodule.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/submodule.c b/src/submodule.c
index 4f7a6c613..b927b17b6 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -231,10 +231,13 @@ static int load_submodule_names(git_strmap *out, git_repository *repo, git_confi
fdot = strchr(entry->name, '.');
ldot = strrchr(entry->name, '.');
+ git_buf_clear(&buf);
git_buf_put(&buf, fdot + 1, ldot - fdot - 1);
isvalid = git_submodule_name_is_valid(repo, buf.ptr, 0);
- if (isvalid < 0)
- return isvalid;
+ if (isvalid < 0) {
+ error = isvalid;
+ goto out;
+ }
if (!isvalid)
continue;
@@ -244,9 +247,13 @@ static int load_submodule_names(git_strmap *out, git_repository *repo, git_confi
return -1;
}
}
+ if (error == GIT_ITEROVER)
+ error = 0;
+out:
+ git_buf_free(&buf);
git_config_iterator_free(iter);
- return 0;
+ return error;
}
int git_submodule_lookup(