config_set: really replace the value on overwrite Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
diff --git a/src/config.c b/src/config.c
index 13c32bc..0870ce6 100644
--- a/src/config.c
+++ b/src/config.c
@@ -163,8 +163,8 @@ static int config_set(git_config *cfg, const char *name, const char *value)
if (tmp == NULL)
return GIT_ENOMEM;
- free(var->value);
- var->value = tmp;
+ free(existing->value);
+ existing->value = tmp;
return GIT_SUCCESS;
}