Plug an unmanaged memory leak
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 30 Sep 2011 05:20:29 +0000 (01:20 -0400)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 30 Sep 2011 05:22:08 +0000 (01:22 -0400)
If Flush() was called with final_flush set to true, we were leaking the
unmanaged memory in the output stream (if allocated).

It was "only" an AS leak.

Thanks to Kumpera for the help debugging this.

mcs/class/System.Web/System.Web/HttpResponse.cs

index 2e633d9666b1ef89cc342cecb4e09bb9b5dcfb3f..6a310ecc874a9bcefd63aecf9fe2c1dfb02bb7ac 100644 (file)
@@ -1365,10 +1365,11 @@ namespace System.Web
 
                internal void ReleaseResources ()
                {
+                       if (output_stream != null)
+                               output_stream.ReleaseResources (true);
                        if (completed)
                                return;
                        
-                       output_stream.ReleaseResources (true);
                        Close ();
                        completed = true;
                }