Commit 956ad0ed by Carlos Martín Nieto

config: free the file buffer earlier

There is no need to keep config file in memory until the the
configuration is freed. Free the buffer immediately after the
configuration has been parsed.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
parent 8bd6c0ab
...@@ -200,6 +200,8 @@ int git_config_open(git_config **cfg_out, const char *path) ...@@ -200,6 +200,8 @@ int git_config_open(git_config **cfg_out, const char *path)
else else
*cfg_out = cfg; *cfg_out = cfg;
gitfo_free_buf(&cfg->reader.buffer);
return error; return error;
cleanup: cleanup:
...@@ -220,7 +222,6 @@ void git_config_free(git_config *cfg) ...@@ -220,7 +222,6 @@ void git_config_free(git_config *cfg)
free(cfg->file_path); free(cfg->file_path);
cvar_list_free(cfg->vars); cvar_list_free(cfg->vars);
gitfo_free_buf(&cfg->reader.buffer);
free(cfg); free(cfg);
} }
......
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