aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-13 14:12:49 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-13 14:12:49 +0000
commitb121e41ec3ae3f5fe355d3802f4c3ddf0f50e190 (patch)
treee5ae39ed927bc52760a067315799971ce1e71c04
parent05d8e56ffdf271c13033a7fa96023afb0685669b (diff)
bail out when no memory occurs
-rw-r--r--lib/url.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/url.c b/lib/url.c
index e3a292cbc..9c4769dfa 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2886,9 +2886,11 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if(user[0]) {
char *newname=curl_unescape(user, 0);
- if(strlen(newname) < sizeof(user)) {
+ if(!newname)
+ return CURLE_OUT_OF_MEMORY;
+ if(strlen(newname) < sizeof(user))
strcpy(user, newname);
- }
+
/* if the new name is longer than accepted, then just use
the unconverted name, it'll be wrong but what the heck */
free(newname);
@@ -2896,9 +2898,11 @@ static CURLcode CreateConnection(struct SessionHandle *data,
if (passwd[0]) {
/* we have a password found in the URL, decode it! */
char *newpasswd=curl_unescape(passwd, 0);
- if(strlen(newpasswd) < sizeof(passwd)) {
+ if(!newpasswd)
+ return CURLE_OUT_OF_MEMORY;
+ if(strlen(newpasswd) < sizeof(passwd))
strcpy(passwd, newpasswd);
- }
+
free(newpasswd);
}
}