combase: Compare AddRef() return value against 1 instead of 0 in find_proxy_manager.

Today, find_proxy_manager() tests if AddRef() returns 0 in an attempt to
protect against a race condition bug.

Note that AddRef does not return zero in normal circumstances, since
AddRef returns the reference count after the increment, not before.

Fix this by comparing the return value of AddRef() against 1, not 0.
This commit is contained in:
Jinoh Kang 2023-05-17 23:30:16 +09:00 committed by Alexandre Julliard
parent b97090214b
commit f55f0b8342

View file

@ -1949,7 +1949,7 @@ static BOOL find_proxy_manager(struct apartment * apt, OXID oxid, OID oid, struc
/* be careful of a race with ClientIdentity_Release, which would
* cause us to return a proxy which is in the process of being
* destroyed */
if (IMultiQI_AddRef(&proxy->IMultiQI_iface) != 0)
if (IMultiQI_AddRef(&proxy->IMultiQI_iface) != 1)
{
*proxy_found = proxy;
found = TRUE;