Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-03-20 09:16:07 +0300
committerJunio C Hamano <gitster@pobox.com>2019-03-20 09:16:07 +0300
commit6b5688b760a11430586122173d96b15fd3204308 (patch)
treeddb27de68f656862e068bb51b97967c3afea6b31 /repository.c
parent83b13e284ce3e349aedfc48fc0fb885c390bb18b (diff)
parente8805af1c33d79750a979014c021cd63d780c720 (diff)
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 5cad2dcc86..682c239fe3 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: