summaryrefslogtreecommitdiff
path: root/src/remote.c
diff options
context:
space:
mode:
authorJustin Spahr-Summers <Justin.SpahrSummers@gmail.com>2012-11-04 22:01:24 -0800
committerJustin Spahr-Summers <Justin.SpahrSummers@gmail.com>2012-11-04 22:01:24 -0800
commit83885891f583ab447f98f1c7a637f1f507e1be22 (patch)
tree66fe1b990a8951d289ab007653cd78960524b81d /src/remote.c
parent1e99ce9ac7d7a73f629327d020034e4b2ed1374c (diff)
downloadlibgit2-83885891f583ab447f98f1c7a637f1f507e1be22.tar.gz
Bail out if remote->url would be NULL
This fixes a crash from attempting to invoke git__strdup() against NULL.
Diffstat (limited to 'src/remote.c')
-rw-r--r--src/remote.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/remote.c b/src/remote.c
index 47bcaf95f..187e3953a 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -131,6 +131,11 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
if ((error = git_config_get_string(&val, config, git_buf_cstr(&buf))) < 0)
goto cleanup;
+
+ if (!val) {
+ error = -1;
+ goto cleanup;
+ }
remote->repo = repo;
remote->url = git__strdup(val);