From cad9c3f55fad5da988144dc83ad76a8544a071a2 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 5 Feb 2010 18:07:19 +0000 Subject: Addes OOM handling for curl_easy_setopt() calls in test --- tests/libtest/lib567.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'tests/libtest/lib567.c') diff --git a/tests/libtest/lib567.c b/tests/libtest/lib567.c index e04873b11..feae2cecf 100644 --- a/tests/libtest/lib567.c +++ b/tests/libtest/lib567.c @@ -32,20 +32,23 @@ int test(char *URL) } /* Dump data to stdout for protocol verification */ - curl_easy_setopt(curl, CURLOPT_HEADERDATA, stdout); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, stdout); + test_setopt(curl, CURLOPT_HEADERDATA, stdout); + test_setopt(curl, CURLOPT_WRITEDATA, stdout); - curl_easy_setopt(curl, CURLOPT_URL, URL); - curl_easy_setopt(curl, CURLOPT_RTSP_STREAM_URI, URL); - curl_easy_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS); - curl_easy_setopt(curl, CURLOPT_USERAGENT, "test567"); + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_RTSP_STREAM_URI, URL); + test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS); + test_setopt(curl, CURLOPT_USERAGENT, "test567"); custom_headers = curl_slist_append(custom_headers, "Test-Number: 567"); - curl_easy_setopt(curl, CURLOPT_RTSPHEADER, custom_headers); + test_setopt(curl, CURLOPT_RTSPHEADER, custom_headers); res = curl_easy_perform(curl); - curl_slist_free_all(custom_headers); +test_cleanup: + + if(custom_headers) + curl_slist_free_all(custom_headers); curl_easy_cleanup(curl); curl_global_cleanup(); -- cgit v1.2.3