mirror of
https://github.com/NixOS/nix
synced 2025-06-29 23:13:14 +02:00
Fix possible deref of null git_config
This commit is contained in:
parent
1cb9a354fb
commit
40e8c5f613
1 changed files with 5 additions and 6 deletions
|
@ -98,11 +98,10 @@ std::string getLfsApiToken(const ParsedURL & url)
|
||||||
|
|
||||||
std::string getLfsEndpointUrl(git_repository * repo)
|
std::string getLfsEndpointUrl(git_repository * repo)
|
||||||
{
|
{
|
||||||
git_config * config = NULL;
|
// FIXME: use Deleter
|
||||||
if (!git_repository_config(&config, repo))
|
git_config * config = nullptr;
|
||||||
;
|
if (git_repository_config(&config, repo)) {
|
||||||
{
|
git_config_entry * entry = nullptr;
|
||||||
git_config_entry * entry = NULL;
|
|
||||||
if (!git_config_get_entry(&entry, config, "lfs.url")) {
|
if (!git_config_get_entry(&entry, config, "lfs.url")) {
|
||||||
auto value = std::string(entry->value);
|
auto value = std::string(entry->value);
|
||||||
if (!value.empty()) {
|
if (!value.empty()) {
|
||||||
|
@ -113,7 +112,7 @@ std::string getLfsEndpointUrl(git_repository * repo)
|
||||||
git_config_entry_free(entry);
|
git_config_entry_free(entry);
|
||||||
}
|
}
|
||||||
git_config_free(config);
|
git_config_free(config);
|
||||||
git_remote * remote = NULL;
|
git_remote * remote = nullptr;
|
||||||
if (git_remote_lookup(&remote, repo, "origin"))
|
if (git_remote_lookup(&remote, repo, "origin"))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue