VariantClear return memory locked errror

  • Thread starter Thread starter an ho
  • Start date Start date
A

an ho

I was trying to get the SchemaIDGUID and I cannot clear
the Variant after I used it. I returned an error of Memory
is locked(0x8002000d)
Have anybody run into this problem before? Is there a way
to handle this problem to avoid memory leaks?

--------------------------------------------
sample code I have:
....
VariantInit(&var);
//use var somewhere here
....
VariantClear(&var);
....
pSchema->Get(L"schemaIDGUID", &var);
SafeArrayAccessData(var.parray, (void **) &pSafeVal);
StringFromGUID2((REFGUID) *pSafeVal, wVal, 40);
if ( pSafeVal )
{
SafeArrayUnaccessData(pSafeVal);
}
hr = VariantClear(&var); //This returned 0x8002000d
 
Back
Top