Frank Hempel fixed a curl_easy_duphandle() crash on a handle that had
authorDaniel Stenberg <daniel@haxx.se>
Sat, 28 Apr 2007 20:27:07 +0000 (20:27 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 28 Apr 2007 20:27:07 +0000 (20:27 +0000)
been removed from a multi handle, and then fixed another flaw that prevented
curl_easy_duphandle() to work even after the first fix - the handle was
still marked as using the multi interface.

CHANGES
RELEASE-NOTES
lib/easy.c

diff --git a/CHANGES b/CHANGES
index d19a74d..d1c070f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,12 @@
 
                                   Changelog
 
+Daniel S (28 April 2007)
+- Frank Hempel fixed a curl_easy_duphandle() crash on a handle that had
+  been removed from a multi handle, and then fixed another flaw that prevented
+  curl_easy_duphandle() to work even after the first fix - the handle was
+  still marked as using the multi interface.
+
 Daniel S (26 April 2007)
 - Peter O'Gorman found a problem with SCP downloads when the downloaded file
   was 16385 bytes (16K+1) and it turned out we didn't properly always "suck
index 33ea5a8..09d56b7 100644 (file)
@@ -30,6 +30,7 @@ This release includes the following bugfixes:
  o bad warning from configure when gnutls was selected
  o compilation on VMS 64-bit mode
  o SCP/SFTP downloads could hang on the last bytes of a transfer
+ o curl_easy_duphandle() crash
 
 This release includes the following known bugs:
 
@@ -52,6 +53,7 @@ This release would not have looked like this without help, code, reports and
 advice from friends like these:
 
  Song Ma, Dan Fandrich, Yang Tse, Jay Austin, Robert Iakobashvil,
- James Housley, Daniel Black, Steve Little, Sonia Subramanian, Peter O'Gorman
+ James Housley, Daniel Black, Steve Little, Sonia Subramanian, Peter O'Gorman,
+ Frank Hempel
 
         Thanks! (and sorry if I forgot to mention someone)
index 939966d..8f590c9 100644 (file)
@@ -511,6 +511,10 @@ void Curl_easy_addmulti(struct SessionHandle *data,
                         void *multi)
 {
   data->multi = multi;
+  if (multi == NULL)
+    /* the association is cleared, mark the easy handle as not used by an
+       interface */
+    data->state.used_interface = Curl_if_none;
 }
 
 void Curl_easy_initHandleData(struct SessionHandle *data)
@@ -636,8 +640,8 @@ CURL *curl_easy_duphandle(CURL *incurl)
 
   if(fail) {
     if(outcurl) {
-      if((outcurl->state.connc->type == CONNCACHE_PRIVATE) &&
-         outcurl->state.connc)
+      if(outcurl->state.connc &&
+         (outcurl->state.connc->type == CONNCACHE_PRIVATE))
         Curl_rm_connc(outcurl->state.connc);
       if(outcurl->state.headerbuff)
         free(outcurl->state.headerbuff);