Sorry, i forgot about the other definitions:
Code:
struct write_result {
char *data;
int pos;
};
and
Code:
static size_t curl_write( void *ptr, size_t size, size_t nmemb, void *stream) {
struct write_result *result = (struct write_result *)stream;
/* Will we overflow on this write? */
if(result->pos + size * nmemb >= (1024 * 256) - 1) {
return 0;
}
/* Copy curl's stream buffer into our own buffer */
memcpy(result->data + result->pos, ptr, size * nmemb);
/* Advance the position */
result->pos += size * nmemb;
return (size * nmemb);
}
I don't think the problem is related to free()ing memory properly either; every time i call inport(), I make sure to free the malloc'd pointer "data" as soon as I've used the returned string... I wonder is there any other error condition that can cause easy_init to crash apart from returning a NULL value? Oddly the program is now into a phase where it's working again (this will no doubt be short-lived), though I haven't changed the code at all, and my connection seems to be just as good as it was before