How to free member (i.e BSTR, SAFEARRAY, VARIANT) of an IDL User Defined Structure which is encapsul
- by Picaro De Vosio
Hi,
I have a structure defined in IDL. This structure has following members:
{
BSTR m_sFirst;
BSTR m_sSecond;
VARIANT m_vChildStruct; //This member encapsulate a sub structure
SAFEARRAY __RPC_FAR * m_saArray;
}CustomINFO;
I am allocating the memory for the structs using CoTaskMemAlloc and encapsulating it in Variant as follows:
vV-vt = VT_RECORD;
vV-pvRecord = pStruct; //Pointer of sturct
vV-pRecInfo = pRI; //RecordInfo Interface
Is it enough to call VariantClear to deallocate the memory of struct and its members?
Will it also release the IRecordInfo interface?
Or i have to manually get the encapsulated struct and deallocate each member myself and then use CoTaskMemFree to deallocate sturct.
Thanks
Picaro De Vosio