summaryrefslogtreecommitdiff
path: root/repository.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-03-20 06:16:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-03-20 06:16:07 (GMT)
commit6b5688b760a11430586122173d96b15fd3204308 (patch)
treeddb27de68f656862e068bb51b97967c3afea6b31 /repository.c
parent83b13e284ce3e349aedfc48fc0fb885c390bb18b (diff)
parente8805af1c33d79750a979014c021cd63d780c720 (diff)
downloadgit-6b5688b760a11430586122173d96b15fd3204308.zip
git-6b5688b760a11430586122173d96b15fd3204308.tar.gz
git-6b5688b760a11430586122173d96b15fd3204308.tar.bz2
Merge branch 'ma/clear-repository-format'
The setup code has been cleaned up to avoid leaks around the repository_format structure. * ma/clear-repository-format: setup: fix memory leaks with `struct repository_format` setup: free old value before setting `work_tree`
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/repository.c b/repository.c
index 5cad2dc..682c239 100644
--- a/repository.c
+++ b/repository.c
@@ -157,7 +157,7 @@ int repo_init(struct repository *repo,
const char *gitdir,
const char *worktree)
{
- struct repository_format format;
+ struct repository_format format = REPOSITORY_FORMAT_INIT;
memset(repo, 0, sizeof(*repo));
repo->objects = raw_object_store_new();
@@ -174,6 +174,7 @@ int repo_init(struct repository *repo,
if (worktree)
repo_set_worktree(repo, worktree);
+ clear_repository_format(&format);
return 0;
error: