aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2014-01-29 08:10:26 +0100
committerDan Fandrich <dan@coneharvesters.com>2014-01-30 22:15:03 +0100
commit768151449b386488ac8fe869f48bf2930123d601 (patch)
tree00f188992e04228c41de7a007d143b8bfe2084a7
parent97857de80eea0b3028036c6796c2f485f4caf7d9 (diff)
netrc: Fixed a memory leak in an OOM condition
-rw-r--r--lib/url.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/url.c b/lib/url.c
index a870cc5d3..3e621bdee 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -4805,13 +4805,17 @@ static CURLcode override_login(struct SessionHandle *data,
conn->bits.netrc = FALSE;
if(data->set.use_netrc != CURL_NETRC_IGNORED) {
- if(Curl_parsenetrc(conn->host.name,
- userp, passwdp,
- data->set.str[STRING_NETRC_FILE])) {
+ int ret = Curl_parsenetrc(conn->host.name,
+ userp, passwdp,
+ data->set.str[STRING_NETRC_FILE]);
+ if(ret > 0) {
infof(data, "Couldn't find host %s in the "
DOT_CHAR "netrc file; using defaults\n",
conn->host.name);
}
+ else if(ret < 0 ) {
+ return CURLE_OUT_OF_MEMORY;
+ }
else {
/* set bits.netrc TRUE to remember that we got the name from a .netrc
file, so that it is safe to use even if we followed a Location: to a