http: free curl header list on error

This commit is contained in:
Adrià Arrufat committed 2026-04-27 17:32:01 +02:00
1 parent 9fbade4573
commit fdadbaaad5
1 file changed
+2
+2
View File
@@ -64,6 +64,8 @@ pub const Headers = struct {
if (header_list == null) {
return error.OutOfMemory;
}
// libcurl leaves the list intact when curl_slist_append fails, so we own it.
errdefer libcurl.curl_slist_free_all(header_list);
// Always add sec-CH-UA header
const with_sec_ch_ua = libcurl.curl_slist_append(header_list, Config.HttpHeaders.sec_ch_ua);