cURL / Mailing Lists / curl-library / Single Mail


[PATCH] examples/getinmemory.c: abort the transfer if not enough memory

From: CÚdric Deltheil <>
Date: Sun, 24 Feb 2013 18:36:50 +0100


So far the getinmemory.c example terminates the process with an EXIT_FAILURE status code if the in-memory growing buffer cannot be reallocated.

Since the write function includes the ability to signal an error to libcurl [1], and let it abort the transfer with a CURLE_WRITE_ERROR, I thought it would be better to use it as a best practice within this example.

Please find attached a (small) patch that avoids using exit(3). In addition there is a 2nd patch that sets the CURLOPT_FOLLOWLOCATION option since includes redirections.



List admin:
Received on 2013-02-24