开发者

How to return an [out] variant with VT = VT_RECORD without creating memory leak in ole32.dll?

开发者 https://www.devze.com 2023-01-03 02:27 出处:网络
Purify is pointing memory leak in ole32.dll while returning a 开发者_运维知识库Variant with VT set to VT_RECORD as OUT parameter. I am using User Marshalling by generating proxy/stub dll from IDL.

Purify is pointing memory leak in ole32.dll while returning a 开发者_运维知识库Variant with VT set to VT_RECORD as OUT parameter. I am using User Marshalling by generating proxy/stub dll from IDL. Can you suggest how to avoid this memory leak?

Struct defined in IDL:

{
BSTR m_sFirst;
BSTR m_sSecond;
VARIANT m_vChildStruct; //This member encapsulate a sub structure 
SAFEARRAY __RPC_FAR * m_saArray;
}CustomINFO;

Encapsulation of struct in variant:

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

Thanks

Picaro De Vosio


there are limitations in support of VT_RECORD. Try checking with http://vcfaq.mvps.org/com/4.htm, might help.

It might also be more helpful if you describe your case in more details (related IDL parts, commpiler version and code describing client/server communication which Purify suspects as leaking )

0

精彩评论

暂无评论...
验证码 换一张
取 消