summaryrefslogtreecommitdiff
path: root/src/config_file.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-08-03 14:28:07 -0700
committerRussell Belfer <rb@github.com>2012-08-24 11:00:27 -0700
commit0c8858de8c82bae3fd88513724689a07d231da7e (patch)
treed2a274f2b1ad0ded6e91caf43e2b3cd8807ce120 /src/config_file.c
parentaa13bf05c84f10f364ce35c5d4f989337b36e043 (diff)
downloadlibgit2-0c8858de8c82bae3fd88513724689a07d231da7e.tar.gz
Fix valgrind issues and leaks
This fixes up a number of problems flagged by valgrind and also cleans up the internal `git_submodule` allocation handling overall with a simpler model.
Diffstat (limited to 'src/config_file.c')
-rw-r--r--src/config_file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/config_file.c b/src/config_file.c
index aabb21f16..d3fb56aaa 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -195,7 +195,7 @@ static int file_foreach(
void *data)
{
diskfile_backend *b = (diskfile_backend *)backend;
- cvar_t *var;
+ cvar_t *var, *next_var;
const char *key;
regex_t regex;
int result = 0;
@@ -212,7 +212,9 @@ static int file_foreach(
}
git_strmap_foreach(b->values, key, var,
- for (; var != NULL; var = CVAR_LIST_NEXT(var)) {
+ for (; var != NULL; var = next_var) {
+ next_var = CVAR_LIST_NEXT(var);
+
/* skip non-matching keys if regexp was provided */
if (regexp && regexec(&regex, key, 0, NULL, 0) != 0)
continue;