From 0a9a2302b44c4fb643e2339b5ebf3e92cf9b7fc9 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 30 Jul 2026 10:01:15 +0200 Subject: [PATCH] Reapply "lib5004.c try memleak fix" This reverts commit 926c7eaf55c2eb2fdf578700b73f964e4f7a4872. --- 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);