From cb64c987a062a9c16ab997415a1440182edb069a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 24 Aug 2010 23:14:00 +0200 Subject: gopher: fix memory leak and busyloop The fix for the busyloop really only is a temporary work-around. It causes a BLOCKING behavior which is a NO-NO. This function should rather be split up in a do and a doing piece where the pieces that aren't possible to send now will be sent in the doing function repeatedly until the entire request is sent. --- lib/gopher.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'lib/gopher.c') diff --git a/lib/gopher.c b/lib/gopher.c index 2fab6dabe..6fe740f75 100644 --- a/lib/gopher.c +++ b/lib/gopher.c @@ -76,6 +76,8 @@ #include "strequal.h" #include "gopher.h" #include "rawstr.h" +#include "select.h" +#include "url.h" #define _MPRINTF_REPLACE /* use our functions only */ #include @@ -122,6 +124,7 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done) curl_off_t *bytecount = &data->req.bytecount; char *path = data->state.path; char *sel; + char *sel_org = NULL; ssize_t amount, k; *done = TRUE; /* unconditionally */ @@ -139,19 +142,21 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done) /* ... then turn ? into TAB for search servers, Veronica, etc. ... */ j = strlen(newp); - if (j) - for(i=0; i