From 770f9a798143e6cf58b67c4646464877b721feb9 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 30 Jul 2026 01:23:07 +0200 Subject: [PATCH] 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 --- tests/libtest/lib5004.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/libtest/lib5004.c b/tests/libtest/lib5004.c index 1f6fb1a223..33945e867f 100644 --- a/tests/libtest/lib5004.c +++ b/tests/libtest/lib5004.c @@ -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);