From 0c73e47b28664f0b61e925ad56e2f16acbd4fa6d Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Fri, 18 Jan 2019 10:51:42 -0800 Subject: [PATCH] Minor cleanup in CURLBindings --- project/src/net/curl/CURLBindings.cpp | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) 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 ()) {