diff options
author | Yang Tse <yangsita@gmail.com> | 2010-02-06 17:30:06 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2010-02-06 17:30:06 +0000 |
commit | 71593dfe57e2b364fb794b1dc993e029e16d57f7 (patch) | |
tree | a45866cc6fee800cd2fb5e3c3293ba2607843145 | |
parent | 0f4a91afdedc4b1f7b02f8b015fde1889d80c104 (diff) |
OOM handling fix
-rw-r--r-- | lib/rtsp.c | 6 | ||||
-rw-r--r-- | lib/url.c | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/rtsp.c b/lib/rtsp.c index 8f3218947..8aaac89ff 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -461,15 +461,17 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done) if(!Curl_checkheaders(data, "Content-Type:")) { result = Curl_add_bufferf(req_buffer, "Content-Type: text/parameters\r\n"); + if(result) + return result; } - if(result) - return result; } if(rtspreq == RTSPREQ_ANNOUNCE) { if(!Curl_checkheaders(data, "Content-Type:")) { result = Curl_add_bufferf(req_buffer, "Content-Type: application/sdp\r\n"); + if(result) + return result; } } @@ -4321,13 +4321,19 @@ static CURLcode set_userpass(struct connectdata *conn, !conn->bits.user_passwd) { conn->user = strdup(CURL_DEFAULT_USER); - conn->passwd = strdup(CURL_DEFAULT_PASSWORD); + if(conn->user) + conn->passwd = strdup(CURL_DEFAULT_PASSWORD); + else + conn->passwd = NULL; /* This is the default password, so DON'T set conn->bits.user_passwd */ } else { /* store user + password, zero-length if not set */ conn->user = strdup(user); - conn->passwd = strdup(passwd); + if(conn->user) + conn->passwd = strdup(passwd); + else + conn->passwd = NULL; } if(!conn->user || !conn->passwd) return CURLE_OUT_OF_MEMORY; |