mirror of
https://github.com/git/git
synced 2024-07-02 15:48:44 +00:00
setup: fix leaking repository format
While populating the `repository_format` structure may cause us to allocate memory, we do not call `clear_repository_format()` in some places and thus potentially leak memory. Fix this. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
4ce14e1325
commit
9972cd6004
2
setup.c
2
setup.c
|
@ -722,6 +722,7 @@ int upgrade_repository_format(int target_version)
|
|||
ret = 1;
|
||||
|
||||
out:
|
||||
clear_repository_format(&repo_fmt);
|
||||
strbuf_release(&repo_version);
|
||||
strbuf_release(&err);
|
||||
return ret;
|
||||
|
@ -2199,6 +2200,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
|
|||
git_dir, len && git_dir[len-1] != '/' ? "/" : "");
|
||||
}
|
||||
|
||||
clear_repository_format(&repo_fmt);
|
||||
free(original_git_dir);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user