mirror of https://github.com/quasar/Quasar.git
Dispose of MemoryStream
IExtension.EndAppend is responsible for cleaning up stream (as it stated). However, this method created a new memory stream from the stream sent to the method that was not cleaned up.
This commit is contained in:
parent
2fd2001057
commit
be233599db
|
@ -27,8 +27,8 @@ void IExtension.EndAppend(Stream stream, bool commit)
|
||||||
int len;
|
int len;
|
||||||
if (commit && (len = (int)stream.Length) > 0)
|
if (commit && (len = (int)stream.Length) > 0)
|
||||||
{
|
{
|
||||||
MemoryStream ms = (MemoryStream)stream;
|
using (MemoryStream ms = (MemoryStream)stream)
|
||||||
|
{
|
||||||
if (buffer == null)
|
if (buffer == null)
|
||||||
{ // allocate new buffer
|
{ // allocate new buffer
|
||||||
buffer = ms.ToArray();
|
buffer = ms.ToArray();
|
||||||
|
@ -59,6 +59,7 @@ void IExtension.EndAppend(Stream stream, bool commit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Stream IExtension.BeginQuery()
|
Stream IExtension.BeginQuery()
|
||||||
{
|
{
|
||||||
|
@ -67,7 +68,11 @@ Stream IExtension.BeginQuery()
|
||||||
|
|
||||||
void IExtension.EndQuery(Stream stream)
|
void IExtension.EndQuery(Stream stream)
|
||||||
{
|
{
|
||||||
using (stream) { } // just clean up
|
// Clean up
|
||||||
|
if (stream != null)
|
||||||
|
{
|
||||||
|
stream.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue