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()); QString _getDescription(const QString description, const QString default_=QString());
public: public:
~Parser() override;
bool parse(const QStringList &arguments); bool parse(const QStringList &arguments);
void process(const QStringList &arguments); void process(const QStringList &arguments);
void process(const QCoreApplication &app); void process(const QCoreApplication &app);

View File

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

View File

@ -4,6 +4,11 @@
using namespace commandline; using namespace commandline;
Parser::~Parser()
{
qDeleteAll(_options);
}
bool Parser::parse(const QStringList &arguments) bool Parser::parse(const QStringList &arguments)
{ {
if (!_parser.parse(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))); Info(_log,"Hyperion instance '%s' has been stopped", QSTRING_CSTR(_instanceTable->getNamebyIndex(instance)));
_runningInstances.remove(instance); _runningInstances.remove(instance);
hyperion->thread()->deleteLater();
hyperion->deleteLater(); hyperion->deleteLater();
emit instanceStateChanged(InstanceState::H_STOPPED, instance); emit instanceStateChanged(InstanceState::H_STOPPED, instance);
emit change(); emit change();

View File

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

View File

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

View File

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