Commit f1b390f5 authored by Alessio Netti's avatar Alessio Netti
Browse files

DCDBPusher: fixing invalid read on RestAPI termination

- Termination of the Rest API relied on a "enabled" flag which was part
of a already-deallocated configuration structure
- Also fixed double termination of the Rest API
parent bec12ea1
......@@ -111,10 +111,7 @@ void sigHandler(int sig) {
//Stop MQTTPusher
LOG(info) << "Flushing MQTT queues...";
//Stop https server
LOG(info) << "Stopping REST API Server...";
void printSyntax()
......@@ -435,6 +432,7 @@ int main(int argc, char** argv) {
LOG(info) << "Signal handlers registered!";
LOG(info) << "Cleaning up...";
bool restAPIEnabled = restAPISettings.enabled;
delete _configuration;
LOG(info) << "Setup complete!";
......@@ -445,17 +443,20 @@ int main(int argc, char** argv) {
//will only continue if interrupted by SIGINT and threads were stopped
LOG(info) << "MQTTPusher stopped.";
if (restAPIEnabled) {
//Stop https server
LOG(info) << "Stopping REST API Server...";
delete _httpsServer;
LOG(info) << "Tearing down objects...";
if (restAPISettings.enabled) {
delete _httpsServer;
delete _mqttPusher;
delete _operatorManager;
delete _pluginManager;
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