]> granicus.if.org Git - curl/commitdiff
OOM handling fix
authorYang Tse <yangsita@gmail.com>
Sat, 6 Feb 2010 17:30:06 +0000 (17:30 +0000)
committerYang Tse <yangsita@gmail.com>
Sat, 6 Feb 2010 17:30:06 +0000 (17:30 +0000)
lib/rtsp.c
lib/url.c

index 8f3218947f25bef11f6ed4fad3766a2daad17de0..8aaac89ff99643e70cd102ca56a48b856d3252bf 100644 (file)
@@ -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;
       }
     }
 
index 8340e52c0c3cc08aa8b5ef7218456ef2e4ba27a0..0b1446c17049160d0f77be7b7b8ec81677b45804 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -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;