summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-28 09:56:59 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-28 09:56:59 +0000
commitaca79af7deb696cc97d7f332ef9c20bdd0096d5b (patch)
tree671626840273b22f6420474c4b17d1b451140dce
parentda6eea9b38f2faf86fc11eac318042b0ac6a0969 (diff)
downloadgnurl-aca79af7deb696cc97d7f332ef9c20bdd0096d5b.tar.gz
gnurl-aca79af7deb696cc97d7f332ef9c20bdd0096d5b.tar.bz2
gnurl-aca79af7deb696cc97d7f332ef9c20bdd0096d5b.zip
check for failing strdup()s
-rw-r--r--lib/url.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/url.c b/lib/url.c
index 65c99981e..e11d58624 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2836,6 +2836,8 @@ static CURLcode CreateConnection(struct SessionHandle *data,
conn->proxy.name = conn->proxy.rawalloc;
free(proxydup); /* free the duplicate pointer and not the modified */
+ if(!conn->proxy.rawalloc)
+ return CURLE_OUT_OF_MEMORY;
}
/*************************************************************
@@ -2964,7 +2966,6 @@ static CURLcode CreateConnection(struct SessionHandle *data,
conn->user = strdup(CURL_DEFAULT_USER);
conn->passwd = strdup(CURL_DEFAULT_PASSWORD);
-
/* This is the default password, so DON'T set conn->bits.user_passwd */
}
else {
@@ -2972,6 +2973,8 @@ static CURLcode CreateConnection(struct SessionHandle *data,
conn->user = strdup(user);
conn->passwd = strdup(passwd);
}
+ if(!conn->user || !conn->passwd)
+ return CURLE_OUT_OF_MEMORY;
/*************************************************************
* Check the current list of connections to see if we can