From: Zoltan Varga Date: Fri, 4 Nov 2011 17:15:10 +0000 (+0100) Subject: Avoid adding a ref in OpenProcess (), it is already added in _wapi_search_handle... X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=123a87c2939f7cd7f4e28625f8f422bc6524cd3c;p=mono.git Avoid adding a ref in OpenProcess (), it is already added in _wapi_search_handle (). Fixes #1682. --- diff --git a/mono/io-layer/handles.c b/mono/io-layer/handles.c index 2aade80c9fc..7eaf93ae082 100644 --- a/mono/io-layer/handles.c +++ b/mono/io-layer/handles.c @@ -816,6 +816,7 @@ _wapi_handle_foreach (WapiHandleType type, * unreffed if the check function returns FALSE, so callers must not * rely on the handle persisting (unless the check function returns * TRUE) + * The caller owns the returned handle. */ gpointer _wapi_search_handle (WapiHandleType type, gboolean (*check)(gpointer test, gpointer user), diff --git a/mono/io-layer/processes.c b/mono/io-layer/processes.c index 06a9a06d579..2404b3cfd2e 100644 --- a/mono/io-layer/processes.c +++ b/mono/io-layer/processes.c @@ -1529,6 +1529,9 @@ gboolean CloseProcess(gpointer handle) return CloseHandle (handle); } +/* + * The caller owns the returned handle and must call CloseProcess () on it to clean it up. + */ gpointer OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, guint32 pid) { /* Find the process handle that corresponds to pid */ @@ -1560,8 +1563,7 @@ gpointer OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_ } } - _wapi_handle_ref (handle); - + /* _wapi_search_handle () already added a ref */ return(handle); }