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