summaryrefslogtreecommitdiff
path: root/src/config_file.c
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2011-11-17 15:10:27 -0800
committerVicent Marti <tanoku@gmail.com>2011-11-22 01:53:56 +0100
commitb762e576c6d0118664320f50be2e5810dbed4c15 (patch)
tree2c244a57ca5167386856c573336093744464daa6 /src/config_file.c
parent1d09a1c88ddde32bf9b6b5ab6a9feab2ecdaa6ff (diff)
downloadlibgit2-b762e576c6d0118664320f50be2e5810dbed4c15.tar.gz
filebuf: add GIT_FILEBUF_INIT and protect multiple opens and cleanups
Update all stack allocations of git_filebuf to use GIT_FILEBUF_INIT and make git_filebuf_open and git_filebuf_cleanup safe to be called multiple times on the same buffer. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/config_file.c')
-rw-r--r--src/config_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/config_file.c b/src/config_file.c
index aec29d4e2..87a430759 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -877,7 +877,7 @@ static int config_write(diskfile_backend *cfg, cvar_t *var)
int section_matches = 0, last_section_matched = 0;
char *current_section = NULL;
char *var_name, *var_value, *data_start;
- git_filebuf file;
+ git_filebuf file = GIT_FILEBUF_INIT;
const char *pre_end = NULL, *post_start = NULL;
/* We need to read in our own config file */