Leak of memory for BSTR friendlyName due to missing call to SysFreeString
JohnLaTwC opened this issue · 0 comments
JohnLaTwC commented
A BSTR friendlyName
is declared but not freed in the main body of getAppDomain
and the memory is leaked as a result
while((hr = icrh->NextDomain(hDomainEnum, &iu)) == S_OK){
! BSTR friendlyName; <<< BSTR declared
...
! hr = appDomain->get_FriendlyName(&friendlyName); <<< BSTR allocated and returned
if(friendlyName && wcscmp(friendlyName, appDomainName) == 0){
iu->Release();
found = true;
+ SysFreeString on friendlyName
break;
}
hr = appDomain->Load_2(SysAllocString(L"BOFNET"), &assembly);
if(assembly == nullptr){
iu->Release();
+ SysFreeString on friendlyName
continue;
}
found = true;
iu->Release();
+ SysFreeString on friendlyName
break;
}
BOF.NET/bofs/bofnet_execute.cpp
Line 115 in 1ef41fe