mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
git access: add proper cleanup function for git_info
We had various random "free parts of the git info" left-overs from when we passed down the git repo data ad-hoc. Get rid of it, and replace it with just doing a 'cleanup_git_info()' that does the final cleanup of it all. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
96337dbbcf
commit
e33680c336
9 changed files with 28 additions and 15 deletions
|
@ -1009,6 +1009,17 @@ static void extract_username(struct git_info *info, char *url)
|
|||
prefs.cloud_storage_email_encoded = strdup(info->username);
|
||||
}
|
||||
|
||||
void cleanup_git_info(struct git_info *info)
|
||||
{
|
||||
if (info->repo)
|
||||
git_repository_free(info->repo);
|
||||
free((void *)info->url);
|
||||
free((void *)info->branch);
|
||||
free((void *)info->username);
|
||||
free((void *)info->localdir);
|
||||
memset(info, 0, sizeof(*info));
|
||||
}
|
||||
|
||||
/*
|
||||
* If it's not a git repo, return NULL. Be very conservative.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue