Fix some leaks (#863)

This commit is contained in:
Murat Seker 2020-07-12 09:22:05 +02:00 committed by GitHub
parent dd98e245fe
commit 69561aea9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 14 deletions

View File

@ -28,6 +28,8 @@ protected:
QString _getDescription(const QString description, const QString default_=QString());
public:
~Parser() override;
bool parse(const QStringList &arguments);
void process(const QStringList &arguments);
void process(const QCoreApplication &app);

View File

@ -256,6 +256,7 @@ public:
{
_width = 1;
_height = 1;
delete[] _pixels;
_pixels = new Pixel_T[2];
_endOfPixels = _pixels + 1;
memset(_pixels, 0, (unsigned long) _width * _height * sizeof(Pixel_T));

View File

@ -4,6 +4,11 @@
using namespace commandline;
Parser::~Parser()
{
qDeleteAll(_options);
}
bool Parser::parse(const QStringList &arguments)
{
if (!_parser.parse(arguments))

View File

@ -194,6 +194,7 @@ void HyperionIManager::handleFinished()
Info(_log,"Hyperion instance '%s' has been stopped", QSTRING_CSTR(_instanceTable->getNamebyIndex(instance)));
_runningInstances.remove(instance);
hyperion->thread()->deleteLater();
hyperion->deleteLater();
emit instanceStateChanged(InstanceState::H_STOPPED, instance);
emit change();

View File

@ -22,9 +22,9 @@ PriorityMuxer::PriorityMuxer(int ledCount)
, _activeInputs()
, _lowestPriorityInfo()
, _sourceAutoSelectEnabled(true)
, _updateTimer(new QTimer())
, _timer(new QTimer())
, _blockTimer(new QTimer())
, _updateTimer(new QTimer(this))
, _timer(new QTimer(this))
, _blockTimer(new QTimer(this))
{
// init lowest priority info
_lowestPriorityInfo.priority = PriorityMuxer::LOWEST_PRIORITY;

View File

@ -42,7 +42,7 @@ void LedDeviceFile::initFile(const QString &fileName)
{
if ( _file == nullptr )
{
_file = new QFile(fileName);
_file = new QFile(fileName, this);
}
}

View File

@ -170,29 +170,29 @@ void HyperionDaemon::freeObjects()
delete _jsonServer;
_flatBufferServer->thread()->quit();
_flatBufferServer->thread()->wait(1000);
_flatBufferServer->deleteLater();
_flatBufferServer->thread()->deleteLater();
delete _flatBufferServer->thread();
delete _flatBufferServer;
_protoServer->thread()->quit();
_protoServer->thread()->wait(1000);
_protoServer->deleteLater();
_protoServer->thread()->deleteLater();
delete _protoServer->thread();
delete _protoServer;
//ssdp before webserver
_ssdp->thread()->quit();
_ssdp->thread()->wait(1000);
_ssdp->deleteLater();
_ssdp->thread()->deleteLater();
delete _ssdp->thread();
delete _ssdp;
_webserver->thread()->quit();
_webserver->thread()->wait(1000);
_webserver->deleteLater();
_webserver->thread()->deleteLater();
delete _webserver->thread();
delete _webserver;
_sslWebserver->thread()->quit();
_sslWebserver->thread()->wait(1000);
_sslWebserver->deleteLater();
_sslWebserver->thread()->deleteLater();
delete _sslWebserver->thread();
delete _sslWebserver;
// stop Hyperions (non blocking)
_instanceManager->stopAll();