Merge branch 'valgrind'

This commit is contained in:
Adriaan de Groot 2017-08-31 04:16:31 -04:00
commit 11ff935453
5 changed files with 27 additions and 9 deletions

View File

@ -57,7 +57,13 @@ ModuleManager::ModuleManager( const QStringList& paths, QObject* parent )
ModuleManager::~ModuleManager()
{}
{
// The map is populated with Module::fromDescriptor(), which allocates on the heap.
for( auto moduleptr : m_loadedModulesByInstanceKey )
{
delete moduleptr;
}
}
void

View File

@ -106,12 +106,22 @@ operator <<( QDebug& s, QList< Device* >::iterator& it )
return s;
}
using DeviceList = QList< Device* >;
static inline DeviceList::iterator
erase(DeviceList& l, DeviceList::iterator& it)
{
Device* p = *it;
auto r = l.erase( it );
if (p)
delete p;
return r;
}
QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
{
bool writableOnly = (which == DeviceType::WritableOnly);
using DeviceList = QList< Device* >;
CoreBackend* backend = CoreBackendManager::self()->backend();
DeviceList devices = backend->scanDevices( true );
@ -123,8 +133,8 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
( *it )->deviceNode().startsWith( "/dev/zram" )
)
{
cDebug() << " .. Removing" << it;
it = devices.erase( it );
cDebug() << " .. Removing zram" << it;
it = erase(devices, it );
}
else if ( writableOnly && (
@ -132,13 +142,13 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize )
isIso9660( *it ) )
)
{
cDebug() << " .. Removing" << it;
it = devices.erase( it );
cDebug() << " .. Removing root-or-CD" << it;
it = erase(devices, it );
}
else if ( (minimumSize >= 0) && !( (*it)->capacity() > minimumSize ) )
{
cDebug() << " .. Removing too-small" << it;
it = devices.erase( it );
it = erase(devices, it );
}
else
++it;

View File

@ -122,6 +122,7 @@ PartitionCoreModule::doInit()
cDebug() << "node\tcapacity\tname\tprettyName";
for ( auto device : devices )
{
// Gives ownership of the Device* to the DeviceInfo object
auto deviceInfo = new DeviceInfo( device );
m_deviceInfos << deviceInfo;
cDebug() << device->deviceNode() << device->capacity() << device->name() << device->prettyName();

View File

@ -23,6 +23,7 @@
EncryptWidget::EncryptWidget( QWidget* parent )
: QWidget( parent )
, m_state( EncryptionDisabled )
{
setupUi( this );

View File

@ -112,7 +112,7 @@ process_device(PedDevice *dev)
int
check_big_enough(long long required_space)
{
PedDevice *dev;
PedDevice *dev = NULL;
ped_exception_fetch_all();
ped_device_probe_all();