dispose some MemoryStreams
parent
025bef4e07
commit
ae191cd304
|
@ -362,8 +362,6 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
||||||
|
|
||||||
imgstream = new MemoryStream();
|
|
||||||
|
|
||||||
// Decode image to System.Drawing.Image
|
// Decode image to System.Drawing.Image
|
||||||
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
|
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
|
||||||
{
|
{
|
||||||
|
@ -404,10 +402,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
if(managedImage != null)
|
if(managedImage != null)
|
||||||
managedImage.Clear();
|
managedImage.Clear();
|
||||||
if (imgstream != null)
|
if (imgstream != null)
|
||||||
{
|
|
||||||
imgstream.Close();
|
|
||||||
imgstream.Dispose();
|
imgstream.Dispose();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
|
@ -368,9 +368,6 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
||||||
|
|
||||||
imgstream = new MemoryStream();
|
|
||||||
|
|
||||||
// Decode image to System.Drawing.Image
|
// Decode image to System.Drawing.Image
|
||||||
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
|
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
|
||||||
{
|
{
|
||||||
|
@ -412,10 +409,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
managedImage.Clear();
|
managedImage.Clear();
|
||||||
|
|
||||||
if (imgstream != null)
|
if (imgstream != null)
|
||||||
{
|
|
||||||
imgstream.Close();
|
|
||||||
imgstream.Dispose();
|
imgstream.Dispose();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
|
@ -216,6 +216,8 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
rc.Request(reqStream, m_Auth);
|
rc.Request(reqStream, m_Auth);
|
||||||
m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", numberWears, agentId);
|
m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", numberWears, agentId);
|
||||||
}
|
}
|
||||||
|
if(reqStream != null)
|
||||||
|
reqStream.Dispose();
|
||||||
}, null, "XBakesModule.Store"
|
}, null, "XBakesModule.Store"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,13 +215,16 @@ namespace OpenSim.Server.Handlers.MapImage
|
||||||
|
|
||||||
private byte[] DocToBytes(XmlDocument doc)
|
private byte[] DocToBytes(XmlDocument doc)
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream();
|
using(MemoryStream ms = new MemoryStream())
|
||||||
XmlTextWriter xw = new XmlTextWriter(ms, null);
|
{
|
||||||
xw.Formatting = Formatting.Indented;
|
using(XmlTextWriter xw = new XmlTextWriter(ms,null))
|
||||||
doc.WriteTo(xw);
|
{
|
||||||
xw.Flush();
|
xw.Formatting = Formatting.Indented;
|
||||||
|
doc.WriteTo(xw);
|
||||||
|
xw.Flush();
|
||||||
|
}
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
|
private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
|
||||||
|
|
Loading…
Reference in New Issue