Примеры ошибок, обнаруженных с помощью диагностики V586
V586. The 'Foo' function is called twice to deallocate the same resource.
Erlang
V586 The 'free' function is called twice for deallocation of the same memory space. erl_call.c 668
int main(int argc, char *argv[])
{
int fd;
char *p = NULL;
ei_cnode ec;
....
int i = 0;
ei_x_buff reply;
....
if (ei_rpc(&ec, fd, "c", "c", p, i, &reply) < 0)
{
free(p);
ei_x_free(&reply);
fprintf(stderr,"erl_call: can't compile file %s\n", fname);
}
free(p); // <=
/* FIXME complete this code
FIXME print out error message as term
if (!erl_match(erl_format("{ok,_}"), reply)) {
fprintf(stderr,"erl_call: compiler errors\n");
}
*/
ei_x_free(&reply);
....
}
Telegram
V586 The 'clear' function is called twice for deallocation of the same resource. Check lines: 122, 126. recent_peers.cpp 126
void RecentPeers::applyLocal(QByteArray serialized)
{
_list.clear();
....
_list.reserve(count);
for (auto i = 0; i != int(count); ++i)
{
....
if (stream.ok() && peer) {
_list.push_back(peer);
} else {
_list.clear(); // <=
DEBUG_LOG(("Suggestions: Failed RecentPeers reading %1 / %2."
).arg(i + 1
).arg(count));
_list.clear(); // <=
return;
}
}
DEBUG_LOG(
("Suggestions: RecentPeers read OK, count: %1").arg(_list.size()));
}
std::vector<not_null<PeerData*>> _list;
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);
....
}
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.
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);
}
....
}
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();
}
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();
}
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();