config: make cvar_free behave more like other free functions Make cvar_free return void instad of the next element, as it was mostly a hack to make cvar_list_free shorter but it's now using the list macros. Also check if the input is NULL and return immediately in that case. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
diff --git a/src/config.c b/src/config.c
index d537fd8..5f0bcd8 100644
--- a/src/config.c
+++ b/src/config.c
@@ -37,15 +37,14 @@ static int config_parse(git_config *cfg_file);
static int parse_variable(git_config *cfg, char **var_name, char **var_value);
void git_config_free(git_config *cfg);
-static git_cvar *cvar_free(git_cvar *var)
+static void cvar_free(git_cvar *var)
{
- git_cvar *next = var->next;
+ if (var == NULL)
+ return;
free(var->name);
free(var->value);
free(var);
-
- return next;
}
static void cvar_list_free(git_cvar_list *list)