lib5004.c try memleak fix

```
test 5004...[HTTP RFC 9421 B.2.6: Ed25519 POST with headers (RFC test vector)]
 105 functions found, but only fail 25 (23.81%)
** MEMORY FAILURE
Leak detected: memory still allocated: 99 bytes
At 6000022c9408, there is 36 bytes.
 allocated by /Users/runner/work/curl/curl/lib/slist.c:87
At 6000039c8e78, there is 31 bytes.
 allocated by /Users/runner/work/curl/curl/lib/slist.c:87
At 6000037dd688, there is 16 bytes.
 allocated by /Users/runner/work/curl/curl/lib/slist.c:62
At 6000037dd628, there is 16 bytes.
 allocated by /Users/runner/work/curl/curl/lib/slist.c:62
LIMIT /Users/runner/work/curl/curl/lib/slist.c:62 malloc reached memlimit
 5004: torture FAILED: function number 10 in test.
 invoke with "-t10" to repeat this single case.
```
https://github.com/curl/curl/actions/runs/30497660391/job/90730128599?pr=22437#step:16:2331
This commit is contained in:
Viktor Szakats 2026-07-30 01:23:07 +02:00
parent d9e6b94337
commit 770f9a7981
No known key found for this signature in database

View file

@ -57,12 +57,11 @@ static CURLcode test_lib5004(const char *URL)
"date: method path authority content-type: content-length:");
easy_setopt(curl, CURLOPT_POSTFIELDS, "{\"hello\": \"world\"}");
headers = curl_slist_append(headers,
"Date: Tue, 20 Apr 2021 02:07:55 GMT");
headers = curl_slist_append(headers,
"Content-Type: application/json");
headers = curl_slist_append(headers,
"Content-Length: 18");
headers = curl_slist_append(NULL, "Date: Tue, 20 Apr 2021 02:07:55 GMT");
if(!headers)
goto test_cleanup;
curl_slist_append(headers, "Content-Type: application/json");
curl_slist_append(headers, "Content-Length: 18");
easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
easy_setopt(curl, CURLOPT_HEADER, 0L);