diff --git a/project/src/net/curl/CURLBindings.cpp b/project/src/net/curl/CURLBindings.cpp index cfdacd414..06639f900 100644 --- a/project/src/net/curl/CURLBindings.cpp +++ b/project/src/net/curl/CURLBindings.cpp @@ -70,6 +70,25 @@ namespace lime { curl_multi_remove_handle ((CURLM*)val_data (multi_handle), (CURL*)val_data (handle)); curlMultiReferences.erase (handle); + std::vector* handles = curlMultiHandles[multi_handle]; + + if (handles->size () > 0) { + + for (std::vector::iterator it = handles->begin (); it != handles->end (); ++it) { + + if (*it == handle) { + + handles->erase (it); + delete curlMultiObjects[handle]; + curlMultiObjects.erase (handle); + break; + + } + + } + + } + } if (curlValid.find (handle) != curlValid.end ()) { @@ -184,6 +203,25 @@ namespace lime { curl_multi_remove_handle ((CURLM*)multi_handle->ptr, (CURL*)handle->ptr); curlMultiReferences.erase (handle); + std::vector* handles = curlMultiHandles[multi_handle]; + + if (handles->size () > 0) { + + for (std::vector::iterator it = handles->begin (); it != handles->end (); ++it) { + + if (*it == handle) { + + handles->erase (it); + delete curlMultiObjects[handle]; + curlMultiObjects.erase (handle); + break; + + } + + } + + } + } if (curlValid.find (handle) != curlValid.end ()) {