aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2017-05-06 15:57:47 +0100
committerUbitUmarov2017-05-06 15:57:47 +0100
commitae191cd3042fec6b753b41b19907d236690a70cf (patch)
treeaaaebcba691cef51e12e98af8b4b9d3d3b31c4bf /OpenSim
parent fix a few wrong placement ( this is a test by the way ) (diff)
downloadopensim-SC_OLD-ae191cd3042fec6b753b41b19907d236690a70cf.zip
opensim-SC_OLD-ae191cd3042fec6b753b41b19907d236690a70cf.tar.gz
opensim-SC_OLD-ae191cd3042fec6b753b41b19907d236690a70cf.tar.bz2
opensim-SC_OLD-ae191cd3042fec6b753b41b19907d236690a70cf.tar.xz
dispose some MemoryStreams
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs5
-rw-r--r--OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs2
-rw-r--r--OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs15
4 files changed, 11 insertions, 17 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
index 062a842..e73cf9e 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
@@ -362,8 +362,6 @@ namespace OpenSim.Capabilities.Handlers
362 { 362 {
363 // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data 363 // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
364 364
365 imgstream = new MemoryStream();
366
367 // Decode image to System.Drawing.Image 365 // Decode image to System.Drawing.Image
368 if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null) 366 if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
369 { 367 {
@@ -404,10 +402,7 @@ namespace OpenSim.Capabilities.Handlers
404 if(managedImage != null) 402 if(managedImage != null)
405 managedImage.Clear(); 403 managedImage.Clear();
406 if (imgstream != null) 404 if (imgstream != null)
407 {
408 imgstream.Close();
409 imgstream.Dispose(); 405 imgstream.Dispose();
410 }
411 } 406 }
412 407
413 return data; 408 return data;
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
index d5df7a2..c339ec5 100644
--- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureRobustHandler.cs
@@ -368,9 +368,6 @@ namespace OpenSim.Capabilities.Handlers
368 try 368 try
369 { 369 {
370 // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data 370 // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
371
372 imgstream = new MemoryStream();
373
374 // Decode image to System.Drawing.Image 371 // Decode image to System.Drawing.Image
375 if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null) 372 if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
376 { 373 {
@@ -412,10 +409,7 @@ namespace OpenSim.Capabilities.Handlers
412 managedImage.Clear(); 409 managedImage.Clear();
413 410
414 if (imgstream != null) 411 if (imgstream != null)
415 {
416 imgstream.Close();
417 imgstream.Dispose(); 412 imgstream.Dispose();
418 }
419 } 413 }
420 414
421 return data; 415 return data;
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
index 27e84b0..cfa9581 100644
--- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
@@ -216,6 +216,8 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
216 rc.Request(reqStream, m_Auth); 216 rc.Request(reqStream, m_Auth);
217 m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", numberWears, agentId); 217 m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", numberWears, agentId);
218 } 218 }
219 if(reqStream != null)
220 reqStream.Dispose();
219 }, null, "XBakesModule.Store" 221 }, null, "XBakesModule.Store"
220 ); 222 );
221 } 223 }
diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
index f292b95..ffd8ef6 100644
--- a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
@@ -215,13 +215,16 @@ namespace OpenSim.Server.Handlers.MapImage
215 215
216 private byte[] DocToBytes(XmlDocument doc) 216 private byte[] DocToBytes(XmlDocument doc)
217 { 217 {
218 MemoryStream ms = new MemoryStream(); 218 using(MemoryStream ms = new MemoryStream())
219 XmlTextWriter xw = new XmlTextWriter(ms, null); 219 {
220 xw.Formatting = Formatting.Indented; 220 using(XmlTextWriter xw = new XmlTextWriter(ms,null))
221 doc.WriteTo(xw); 221 {
222 xw.Flush(); 222 xw.Formatting = Formatting.Indented;
223 223 doc.WriteTo(xw);
224 xw.Flush();
225 }
224 return ms.ToArray(); 226 return ms.ToArray();
227 }
225 } 228 }
226 229
227 private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) 230 private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)