c++ - BSTR memory leak in atldbsch.h - what to do? -
i running deleaker application find , fix memory leaks in application. now, finds lot of bstr leaks roots in open()-function of microsoft crestrictions class (atldbsch.h file).
if 1 looks there 1 can notice takes 7 lpctstr parameters, used this:
pvariant = m_pvarrestrictions + 1; . . pvariant->bstrval = ::sysallocstring(t2cole_ex_def(lpszparam1));
this done 7 such parameters (where number 1 increased every time).
the destructor doing
delete[] m_pvarrestrictions;
but bstrs allocated via ::sysallocstring() never freed though via calls ::sysfreestr()
am missing or there leak, , in case how should handled in case?
according https://github.com/dpalma/sge/blob/master/3rdparty/atl/atldbsch.h, m_pvarrestrictions
defined atl::ccomvariant *
, atl::ccomvariant
destructor should cleaning bstr
variants (the code correctly setting vt
vt_bstr
). is, ccomvariant
destructor calls ccomvariant::clear
calls variantclear
.
thus, there should not memory leak here -- code looks correct. issue deleaker having problems detecting pattern.
Comments
Post a Comment