diff --git a/MimeKit/IO/Filters/MimeFilterBase.cs b/MimeKit/IO/Filters/MimeFilterBase.cs index 2ad41f40ee..d8d5c9a4f3 100644 --- a/MimeKit/IO/Filters/MimeFilterBase.cs +++ b/MimeKit/IO/Filters/MimeFilterBase.cs @@ -35,10 +35,10 @@ namespace MimeKit.IO.Filters { /// public abstract class MimeFilterBase : IMimeFilter { - byte[] output = new byte[4096]; - byte[] preload = null; - byte[] inbuf = null; int preloadLength; + byte[] preload; + byte[] output; + byte[] inbuf; /// /// Initializes a new instance of the class. @@ -221,15 +221,12 @@ protected void SaveRemainingInput (byte[] input, int startIndex, int length) /// If set to true, the current output should be preserved. protected void EnsureOutputSize (int size, bool keep) { - if (size == 0) - return; - - int outputSize = output != null ? output.Length : 0; + int outputSize = output != null ? output.Length : -1; if (outputSize >= size) return; - if (keep) + if (keep && output != null) Array.Resize (ref output, GetIdealBufferSize (size)); else output = new byte[GetIdealBufferSize (size)];