From e2e593a036c992f2d38e060e14b52c4a8862ca2d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 14 May 2004 09:22:12 +0000 Subject: clean up properly on failure to enable easier libcurl leak detection --- tests/libtest/lib505.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests/libtest/lib505.c') diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c index 131df7856..62c7b6880 100644 --- a/tests/libtest/lib505.c +++ b/tests/libtest/lib505.c @@ -72,9 +72,14 @@ int test(char *URL) /* get a curl handle */ curl = curl_easy_init(); if(curl) { + struct curl_slist *hl; /* build a list of commands to pass to libcurl */ - headerlist = curl_slist_append(headerlist, buf_1); - headerlist = curl_slist_append(headerlist, buf_2); + hl = curl_slist_append(headerlist, buf_1); + if(hl) { + headerlist = curl_slist_append(hl, buf_2); + if(hl) + headerlist = hl; + } /* enable uploading */ curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ; -- cgit v1.2.3