[sldev] Curl not properly cleaned up / VWR-805

Nicholaz Beresford nicholaz at blueflash.cc
Mon May 21 23:54:12 PDT 2007


Curl library is not properly cleaned up (due to use of instantiation magic)

https://jira.secondlife.com/browse/VWR-805

Patch attached
-------------- next part --------------
--- linden-orig/indra/llmessage/llcurl.h	2007-05-14 16:47:20.000000000 +0200
+++ linden/indra/llmessage/llcurl.h	2007-05-22 08:36:44.062500000 +0200
@@ -105,6 +105,8 @@
 
 	static void get(const std::string& url, ResponderPtr);
 	static void getByteRange(const std::string& url, S32 offset, S32 length, ResponderPtr responder);
+
+	static void cleanup();		// VWR-805 need to clean global Multi and clean libcurl [Nicholaz Beresford]
 	
 	static void process();
 };
--- linden-orig/indra/llmessage/llcurl.cpp	2007-05-14 16:47:20.000000000 +0200
+++ linden/indra/llmessage/llcurl.cpp	2007-05-22 08:37:17.828125000 +0200
@@ -321,6 +321,22 @@
 		}
 		return sMainMulti;
 	}
+	
+	// PATCH [Nicholaz Beresford]
+	//
+	// global/static CurlMulti object was not freed and curl library not cleaned up
+	//
+	// VWR-805
+	void
+	freeMulti()
+	{	
+		if (sMainMulti) 
+		{
+			delete sMainMulti;
+			sMainMulti = NULL;
+		}
+	}
+	// ~PATCH
 }
 
 void
@@ -341,3 +357,17 @@
 	mainMulti()->process();
 }
 
+// PATCH [Nicholaz Beresford]
+//
+// global/static CurlMulti object was not freed and curl library not cleaned up
+//
+// VWR-805
+void 
+LLCurl::cleanup()
+{
+	freeMulti();
+
+	curl_global_cleanup();
+}
+//
+// ~PATCH
--- linden-orig/indra/newview/viewer.cpp	2007-05-14 16:47:26.000000000 +0200
+++ linden/indra/newview/viewer.cpp	2007-05-22 08:49:36.453125000 +0200
@@ -6562,6 +6562,8 @@
 	delete gVFS;
 	gVFS = NULL;
 	
+	LLCurl::cleanup();  // VWR-805 / Cleanup curl instance [Nicholaz Beresford]
+
 	// This will eventually be done in LLApp
 	LLCommon::cleanupClass();
 }


More information about the SLDev mailing list