diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index 2a121ccdbb0..b213f501f68 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -511,8 +511,18 @@ static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc) newObject->fontLock = 0; newObject->cyLogical = 72L; newObject->cyHimetric = 2540L; + newObject->pPropertyNotifyCP = NULL; + newObject->pFontEventsCP = NULL; + CreateConnectionPoint((IUnknown*)newObject, &IID_IPropertyNotifySink, &newObject->pPropertyNotifyCP); CreateConnectionPoint((IUnknown*)newObject, &IID_IFontEventsDisp, &newObject->pFontEventsCP); + + if (!newObject->pPropertyNotifyCP || !newObject->pFontEventsCP) + { + OLEFontImpl_Destroy(newObject); + return NULL; + } + TRACE("returning %p\n", newObject); return newObject; } @@ -533,6 +543,11 @@ static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc) if (fontDesc->gdiFont!=0) DeleteObject(fontDesc->gdiFont); + if (fontDesc->pPropertyNotifyCP) + IConnectionPoint_Release(fontDesc->pPropertyNotifyCP); + if (fontDesc->pFontEventsCP) + IConnectionPoint_Release(fontDesc->pFontEventsCP); + HeapFree(GetProcessHeap(), 0, fontDesc); }