Commit 747605d4 authored by Slava Monich's avatar Slava Monich

[transfer-engine] Fix memory leaks

parent d07f52cc
...@@ -405,7 +405,7 @@ int DbManager::createCallbackEntry(int key, ...@@ -405,7 +405,7 @@ int DbManager::createCallbackEntry(int key,
This method returns a key of the created transfer or -1 on failure. This method returns a key of the created transfer or -1 on failure.
*/ */
int DbManager::createTransferEntry(MediaItem *mediaItem) int DbManager::createTransferEntry(const MediaItem *mediaItem)
{ {
Q_D(DbManager); Q_D(DbManager);
QSqlQuery query; QSqlQuery query;
......
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
const QString &cancelMethod, const QString &cancelMethod,
const QString &restartMethod); const QString &restartMethod);
int createTransferEntry(MediaItem *mediaItem); int createTransferEntry(const MediaItem *mediaItem);
bool updateTransferStatus(int key, TransferEngineData::TransferStatus status); bool updateTransferStatus(int key, TransferEngineData::TransferStatus status);
......
...@@ -236,10 +236,8 @@ void TransferEnginePrivate::enabledPluginsCheck() ...@@ -236,10 +236,8 @@ void TransferEnginePrivate::enabledPluginsCheck()
if (info->ready()) { if (info->ready()) {
if (info->info().count() > 0) { if (info->info().count() > 0) {
m_enabledPlugins << info->info(); m_enabledPlugins << info->info();
} else {
// Plugin has nothing to provide, just ignore it
delete info;
} }
delete info;
} else { } else {
// These object will be cleaned in pluginInfoReady() slot. // These object will be cleaned in pluginInfoReady() slot.
m_infoObjects << info; m_infoObjects << info;
...@@ -1020,6 +1018,8 @@ int TransferEngine::createSync(const QString &displayName, ...@@ -1020,6 +1018,8 @@ int TransferEngine::createSync(const QString &displayName,
mediaItem->setValue(MediaItem::RestartSupported,!restartMethod.isEmpty()); mediaItem->setValue(MediaItem::RestartSupported,!restartMethod.isEmpty());
const int key = DbManager::instance()->createTransferEntry(mediaItem); const int key = DbManager::instance()->createTransferEntry(mediaItem);
delete mediaItem;
Q_D(TransferEngine); Q_D(TransferEngine);
d->m_activityMonitor->newActivity(key); d->m_activityMonitor->newActivity(key);
d->m_keyTypeCache.insert(key, TransferEngineData::Sync); d->m_keyTypeCache.insert(key, TransferEngineData::Sync);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment