From d60c22572b49cde9b839a59510580df079d2d5e2 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 12 May 2004 12:06:39 +0000 Subject: Curl_done() and the protocol-specific conn->curl_done() functions now all take a CURLcode as a second argument, that is non-zero when Curl_done() is called after an error was returned from Curl_do() (or similar). --- lib/transfer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/transfer.c') diff --git a/lib/transfer.c b/lib/transfer.c index 67f328971..95dbf568a 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -853,6 +853,8 @@ CURLcode Curl_readwrite(struct connectdata *conn, *ptr = '\0'; /* zero terminate */ conn->newurl = strdup(start); /* clone string */ *ptr = backup; /* restore ending letter */ + if(!conn->newurl) + return CURLE_OUT_OF_MEMORY; } } #if 0 /* for consideration */ @@ -1967,7 +1969,7 @@ CURLcode Curl_perform(struct SessionHandle *data) to the new URL */ urlchanged = data->change.url_changed; if ((CURLE_OK == res) && urlchanged) { - res = Curl_done(conn); + res = Curl_done(conn, res); if(CURLE_OK == res) { char *gotourl = strdup(data->change.url); res = Curl_follow(data, gotourl); @@ -2024,14 +2026,14 @@ CURLcode Curl_perform(struct SessionHandle *data) /* Always run Curl_done(), even if some of the previous calls failed, but return the previous (original) error code */ - res2 = Curl_done(conn); + res2 = Curl_done(conn, res); if(CURLE_OK == res) res = res2; } else /* Curl_do() failed, clean up left-overs in the done-call */ - res2 = Curl_done(conn); + res2 = Curl_done(conn, res); /* * Important: 'conn' cannot be used here, since it may have been closed -- cgit v1.2.3