From a319e79528df9f12cbba699384cd503e17714ca2 2015-01-03 22:45:07 From: Vitaly Takmazov Date: 2015-01-03 22:45:07 Subject: [PATCH] smstools3 backend: fix possible segmentation fault --- diff --git a/backends/smstools3/main.cpp b/backends/smstools3/main.cpp index 9e5600ffdd02295c3303a791e5775b32947400f3..f69fea53d0d49480b66366494d37b8706c1f2201 100644 --- a/backends/smstools3/main.cpp +++ b/backends/smstools3/main.cpp @@ -40,7 +40,6 @@ DEFINE_LOGGER(logger, "SMSNetworkPlugin"); class SMSNetworkPlugin; SMSNetworkPlugin * np = NULL; -StorageBackend *storageBackend; class SMSNetworkPlugin : public NetworkPlugin { public: @@ -49,9 +48,11 @@ class SMSNetworkPlugin : public NetworkPlugin { boost::shared_ptr m_conn; Swift::Timer::ref m_timer; int m_internalUser; + StorageBackend *storageBackend; - SMSNetworkPlugin(Config *config, Swift::SimpleEventLoop *loop, const std::string &host, int port) : NetworkPlugin() { + SMSNetworkPlugin(Config *config, Swift::SimpleEventLoop *loop, StorageBackend *storagebackend, const std::string &host, int port) : NetworkPlugin() { this->config = config; + this->storageBackend = storagebackend; m_factories = new Swift::BoostNetworkFactories(loop); m_conn = m_factories->getConnectionFactory()->createConnection(); m_conn->onDataRead.connect(boost::bind(&SMSNetworkPlugin::_handleDataRead, this, _1)); @@ -283,7 +284,7 @@ int main (int argc, char* argv[]) { Swift::SimpleEventLoop eventLoop; loop_ = &eventLoop; - np = new SMSNetworkPlugin(cfg, &eventLoop, host, port); + np = new SMSNetworkPlugin(cfg, &eventLoop, storageBackend, host, port); loop_->run(); return 0;