【发布时间】:2026-01-27 05:15:02
【问题描述】:
代码如下所示:
class A
{
public:
std::string name;
};
A a;
CComBSTR textValue;
// some function which fills textValue
a.name = W2A(textValue);
现在,我使用了 CComBSTR,因此我不必释放 BString,但是 W2A 是否分配了我可能必须处理的任何内存?即我应该有:
char *tmp = W2A(textValue);
a.name = tmp;
// do something to deallocate tmp?
【问题讨论】: