ConnectionKillOne() _can_ return -1 as an indication of error
authorDaniel Stenberg <daniel@haxx.se>
Wed, 12 Sep 2001 08:00:30 +0000 (08:00 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 12 Sep 2001 08:00:30 +0000 (08:00 +0000)
This is T. Bharath's fix

lib/url.c

index 4a7c57ff957c866582bb33676471a81cd00ec9b1..cfcac7322fdee77ba63b42d7419442828821c88b 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -1097,10 +1097,14 @@ ConnectionStore(struct SessionHandle *data,
     infof(data, "Connection (#%d) was killed to make room\n", i);
   }
 
-  data->state.connects[i] = conn; /* fill in this */
-  conn->connectindex = i; /* make the child know where the pointer to this
-                             particular data is stored */
-
+  if(-1 != i) {
+    /* only do this if a true index was returned, if -1 was returned there
+       is no room in the cache for an unknown reason and we cannot store
+       this there. */
+    data->state.connects[i] = conn; /* fill in this */
+    conn->connectindex = i; /* make the child know where the pointer to this
+                               particular data is stored */
+  }
   return i;
 }