Module: wine Branch: master Commit: 6f917d49c1798eb7693c606c29fa1b65bce63171 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6f917d49c1798eb7693c606c29...
Author: Rob Shearman rob@codeweavers.com Date: Thu Nov 22 19:08:23 2007 +0000
ole32: Fix a race in find_proxy_manager.
---
dlls/ole32/marshal.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c index fcfbd64..fde189a 100644 --- a/dlls/ole32/marshal.c +++ b/dlls/ole32/marshal.c @@ -1097,10 +1097,15 @@ static BOOL find_proxy_manager(APARTMENT * apt, OXID oxid, OID oid, struct proxy struct proxy_manager * proxy = LIST_ENTRY(cursor, struct proxy_manager, entry); if ((oxid == proxy->oxid) && (oid == proxy->oid)) { - *proxy_found = proxy; - ClientIdentity_AddRef((IMultiQI *)&proxy->lpVtbl); - found = TRUE; - break; + /* 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 (ClientIdentity_AddRef((IMultiQI *)&proxy->lpVtbl) != 0) + { + *proxy_found = proxy; + found = TRUE; + break; + } } } LeaveCriticalSection(&apt->cs);