← Commit list

1bf663e32f

Daniel Stenberg
Daniel Stenberg
2026-04-03
SUCCESS Duration: 232s

Subject

dnscache: fix locking for negative caching

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/dnscache.c+4 -0
@@ -601,6 +601,8 @@ CURLcode Curl_dnscache_add_negative(struct Curl_easy *data,
if(!dnscache)
return CURLE_FAILED_INIT;
+ dnscache_lock(data, dnscache);
+
/* put this new host in the cache */
dns = dnscache_add_addr(data, dnscache, dns_queries, NULL,
host, strlen(host), port, FALSE);
@@ -608,10 +610,12 @@ CURLcode Curl_dnscache_add_negative(struct Curl_easy *data,
/* release the returned reference; the cache itself will keep the
* entry alive: */
dns->refcount--;
+ dnscache_unlock(data, dnscache);
CURL_TRC_DNS(data, "cache negative name resolve for %s:%d type=%s",
host, port, Curl_resolv_query_str(dns_queries));
return CURLE_OK;
}
+ dnscache_unlock(data, dnscache);
return CURLE_OUT_OF_MEMORY;
}