[io-layer] Don't RC std handles or the current process on every lookup.
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 16 Mar 2017 22:58:11 +0000 (15:58 -0700)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 5 Apr 2017 21:18:26 +0000 (14:18 -0700)
Caller don't expect those lookups to be RC'd so they don't compensate. This leads to unbound growth of their ref count, which eventually overflows.

mono/metadata/w32file-unix.c
mono/metadata/w32process-unix.c

index 734b43b41f629ccad056873ed12050c78d9db1a1..f6e4d2df5138873927882d9bd3cda436dcba411b 100644 (file)
@@ -3111,9 +3111,6 @@ mono_w32file_get_std_handle (gint stdhandle)
                        mono_w32error_set_last (ERROR_NO_MORE_FILES);
                        goto done;
                }
-       } else {
-               /* Add a reference to this handle */
-               mono_w32handle_ref (handle);
        }
        
   done:
index 475112d39c7b0af0e8983e1946158f72b9d4a573..596af9b321d07ae1945e3e4d46e55a52c5b4d8fb 100644 (file)
@@ -2320,7 +2320,6 @@ mono_w32process_set_cli_launcher (gchar *path)
 gpointer
 ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess (void)
 {
-       mono_w32handle_ref (current_process);
        return current_process;
 }