summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2016-02-15 11:28:33 +0100
committerPatrick Steinhardt <ps@pks.im>2016-02-18 20:50:33 +0100
commit8a62bf11806d9118301999ff9c58d55057d06917 (patch)
treeb6c7a738741f1158f48cf603d47a9ffab48bb48f
parentb0f7512f407284c9eec91681a7ced5c93e026644 (diff)
downloadlibgit2-8a62bf11806d9118301999ff9c58d55057d06917.tar.gz
netops: fix memory leak when an error occurs
-rw-r--r--src/netops.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/netops.c b/src/netops.c
index 5e8075597..c4241989f 100644
--- a/src/netops.c
+++ b/src/netops.c
@@ -261,6 +261,10 @@ int gitno_extract_url_parts(
*path = git__substrdup(_path, u.field_data[UF_PATH].len);
GITERR_CHECK_ALLOC(*path);
} else {
+ git__free(*port);
+ *port = NULL;
+ git__free(*host);
+ *host = NULL;
giterr_set(GITERR_NET, "invalid url, missing path");
return GIT_EINVALIDSPEC;
}