This is to track the regression introduced in master, which needs fixing for 0.14. See #9240, #9371, etc.
{
public:
    CMainCleanup() {}
    ~CMainCleanup() {
        
        BlockMap::iterator it1 = mapBlockIndex.begin();
        for (; it1 != mapBlockIndex.end(); it1++)
            delete (*it1).second;
        mapBlockIndex.clear();
    }
} instance_of_cmaincleanup;