curl-library
Custom http head free memory
Date: Tue, 6 Nov 2012 16:04:19 +0800
when i use curl_slist_append<http://curl.haxx.se/libcurl/c/curl_slist_append.html>
to
make my custom http head , must i free the memory like this?
struct curl_slist *headers=NULL; headers = curl_slist_append(headers,
"Content-Type: text/xml");
/* post binary data */ curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS,
binaryptr);
/* set the size of the postfields data */ curl_easy_setopt(easyhandle,
CURLOPT_POSTFIELDSIZE, 23L);
/* pass our list of custom made headers */ curl_easy_setopt(easyhandle,
CURLOPT_HTTPHEADER, headers);
curl_easy_perform(easyhandle); /* post away! */
curl_slist_free_all(headers); /* free the header list */
but i saw some example don't free the headers , like "httpcustomheader.c"
in http://curl.haxx.se/libcurl/c/httpcustomheader.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-11-06