Examples of errors detected by the V586 diagnostic
V586. The 'Foo' function is called twice to deallocate the same resource.
Blender
V586 The 'clear' function is called twice for deallocation of the same resource. Check lines: 176, 177. bf_intern_elbeem ntl_geometrymodel.cpp 177
int ntlGeometryObjModel::initModel(....)
{
....
ntlSetVec3f averts; averts.mVerts.clear();
ntlSetVec3f anorms; averts.mVerts.clear();
....
}
This is what should have been written here: ntlSetVec3f averts; averts.mVerts.clear(); ntlSetVec3f anorms; anorms.mVerts.clear();
OpenMW
V586 The 'clear' function is called twice for deallocation of the same resource. Check lines: 48, 49. components loadclot.cpp 49
void Clothing::blank()
{
mData.mType = 0;
mData.mWeight = 0;
mData.mValue = 0;
mData.mEnchant = 0;
mParts.mParts.clear();
mName.clear();
mModel.clear();
mIcon.clear();
mIcon.clear();
mEnchant.clear();
mScript.clear();
}
VNL
V586 The 'clear' function is called twice for deallocation of the same resource. Check lines: 202, 203. testlib_main.cxx 203
void testlib_register_test(const vcl_string & name,
TestMainFunction func)
{
testlib_test_func_.push_back(func);
testlib_test_name_.push_back(name);
}
void testlib_cleanup()
{
testlib_test_func_.clear();
testlib_test_func_.clear();
}
Miranda NG
V586 The 'DeleteObject' function is called twice for deallocation of the same resource. Check lines: 264, 273. UInfoEx svc_flagsicons.cpp 273
static INT_PTR ServiceCreateMergedFlagIcon(....)
{
HRGN hrgn;
....
if (hrgn!=NULL) {
SelectClipRgn(hdc,hrgn);
DeleteObject(hrgn);
....
DeleteObject(hrgn);
}
....
}
OpenMW
V586 The 'clear' function is called twice for deallocation of the same resource. Check lines: 110, 117. loadregn.cpp 117
std::string mId, mName, mSleepList;
void Region::blank()
{
mName.clear();
mData.mClear = mData.mCloudy = mData.mFoggy = mData.mOvercast =
mData.mRain = mData.mThunder = mData.mAsh,
mData.mBlight = mData.mA = mData.mB = 0;
mMapColor = 0;
mName.clear();
mSleepList.clear();
mSoundList.clear();
}
mName string is cleared two times. Apparently mId string should be cleared in one place.
Blender
V586 The 'clear' function is called twice for deallocation of the same resource. Check lines: 149, 156. tile.cpp 156
int TileManager::gen_tiles(bool sliced)
{
....
state.tiles.clear(); // <=
....
int tile_index = 0;
state.tiles.clear();
state.tiles.resize(num);
....
}