Commit b2e361cc by Carlos Martín Nieto

Plug two leaks in config writing

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
parent d144c569
......@@ -986,10 +986,19 @@ static int config_write(diskfile_backend *cfg, cvar_t *var)
break;
}
} else {
int cmp;
pre_end = cfg->reader.read_ptr;
error = parse_variable(cfg, &var_name, &var_value);
if (error < GIT_SUCCESS || strcasecmp(var->name, var_name))
if (error == GIT_SUCCESS)
cmp = strcasecmp(var->name, var_name);
free(var_name);
free(var_value);
if (error < GIT_SUCCESS || cmp)
break;
post_start = cfg->reader.read_ptr;
}
......@@ -1060,6 +1069,7 @@ static int config_write(diskfile_backend *cfg, cvar_t *var)
else
error = git_filebuf_commit(&file);
gitfo_free_buf(&cfg->reader.buffer);
return error;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment