From 2a7a1bbee2116d1ec242920c68fa12dfdf747347 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 19 Oct 2020 12:39:35 +0300 Subject: [PATCH] server: Handle duplicate handles when inheriting them for the new process. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50004 Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- server/handle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/handle.c b/server/handle.c index 15382256f10..2556a03901e 100644 --- a/server/handle.c +++ b/server/handle.c @@ -363,8 +363,9 @@ static void inherit_handle( struct process *parent, const obj_handle_t handle, s src = get_handle( parent, handle ); if (!src || !(src->access & RESERVED_INHERIT)) return; - grab_object_for_handle( src->ptr ); index = handle_to_index( handle ); + if (dst[index].ptr) return; + grab_object_for_handle( src->ptr ); dst[index] = *src; table->last = max( table->last, index ); }