Skip to content

Commit 2522ec1

Browse files
learn-moreJoachimHenze
authored andcommitted
[0.4.11] [OLE32] Apply the proper Wine fix for CORE-14696
Don't free handles that are just copied in the inproc case. This imports wine commit 25b136d40080a80c006b89e02708d2e248504a42, by Huw Davies and Zebediah Figura cherry picked from commit 0.4.12-dev-96-g 959994b
1 parent b93990e commit 2522ec1

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

dll/win32/ole32/usrmarshal.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,11 +2036,29 @@ unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(ULONG *pFlags, unsigned char
20362036
* which the first parameter is a ULONG.
20372037
* This function is only intended to be called by the RPC runtime.
20382038
*/
2039-
void __RPC_USER STGMEDIUM_UserFree(ULONG *pFlags, STGMEDIUM *pStgMedium)
2039+
void __RPC_USER STGMEDIUM_UserFree(ULONG *flags, STGMEDIUM *med)
20402040
{
2041-
TRACE("(%s, %p\n", debugstr_user_flags(pFlags), pStgMedium);
2041+
TRACE("(%s, %p)\n", debugstr_user_flags(flags), med);
20422042

2043-
ReleaseStgMedium(pStgMedium);
2043+
switch (med->tymed)
2044+
{
2045+
case TYMED_NULL:
2046+
case TYMED_FILE:
2047+
case TYMED_ISTREAM:
2048+
case TYMED_ISTORAGE:
2049+
ReleaseStgMedium(med);
2050+
break;
2051+
case TYMED_HGLOBAL:
2052+
case TYMED_GDI:
2053+
case TYMED_MFPICT:
2054+
case TYMED_ENHMF:
2055+
if (LOWORD(*flags) == MSHCTX_INPROC)
2056+
med->tymed = TYMED_NULL;
2057+
ReleaseStgMedium(med);
2058+
break;
2059+
default:
2060+
RaiseException(DV_E_TYMED, 0, 0, NULL);
2061+
}
20442062
}
20452063

20462064
ULONG __RPC_USER ASYNC_STGMEDIUM_UserSize(ULONG *pFlags, ULONG StartingSize, ASYNC_STGMEDIUM *pStgMedium)

0 commit comments

Comments
 (0)