From 956ad0ed6f6a4d0008f00d573972f8f7fa654811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 6 Apr 2011 15:51:10 +0200 Subject: [PATCH] config: free the file buffer earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index e164dc2b9..0704f074d 100644 --- a/src/config.c +++ b/src/config.c @@ -200,6 +200,8 @@ int git_config_open(git_config **cfg_out, const char *path) else *cfg_out = cfg; + gitfo_free_buf(&cfg->reader.buffer); + return error; cleanup: @@ -220,7 +222,6 @@ void git_config_free(git_config *cfg) free(cfg->file_path); cvar_list_free(cfg->vars); - gitfo_free_buf(&cfg->reader.buffer); free(cfg); }