* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* KIND, either express or implied.
*
***************************************************************************/
-/* <DESC>
- * Shows how the write callback function can be used to download data into a
- * chunk of memory instead of storing it in a file.
- * </DESC>
+/* Example source code to show how the callback function can be used to
+ * download data into a chunk of memory instead of storing it in a file.
*/
#include <stdio.h>
size_t size;
};
+
static size_t
WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
return realsize;
}
+
int main(void)
{
CURL *curl_handle;
/* cleanup curl stuff */
curl_easy_cleanup(curl_handle);
- free(chunk.memory);
+ if(chunk.memory)
+ free(chunk.memory);
/* we're done with libcurl, so clean it up */
curl_global_cleanup();