]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cf-socket: return OOM error if socket() failes due to OOM
authorDaniel Stenberg <daniel@haxx.se>
Fri, 26 Dec 2025 10:00:00 +0000 (11:00 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 27 Dec 2025 15:25:38 +0000 (16:25 +0100)
Closes #20100

lib/cf-socket.c

index c0f01c1a00ef1c0fa5f43e42206757187257e944..ce728f5b3ee404699cb97ad9eecc4387c18eb038 100644 (file)
@@ -346,6 +346,8 @@ static CURLcode socket_open(struct Curl_easy *data,
   else {
     /* opensocket callback not set, so simply create the socket now */
     *sockfd = CURL_SOCKET(addr->family, addr->socktype, addr->protocol);
+    if((*sockfd == CURL_SOCKET_BAD) && (SOCKERRNO == SOCKENOMEM))
+      return CURLE_OUT_OF_MEMORY;
   }
 
   if(*sockfd == CURL_SOCKET_BAD) {