I'm not really up on the code he's using, but it seems that the code here probably contributes.

VARIANT vtProp;
...
QueryResult = vtProp.bstrVal;
...
VariantClear(&vtProp);
...
return...