Skip to content

Commit

Permalink
Fix memleaks found with AddressSanitizer/LeakSanitizer
Browse files Browse the repository at this point in the history
Fixes:
Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7efeb72f46b8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    f4exb#1 0x7efe834b65a2 in WebServer::WebServer(unsigned short&, QObject*) sdrangel/plugins/feature/map/webserver.cpp:34
    f4exb#2 0x7efe834bc342 in MapGUI::MapGUI(PluginAPI*, FeatureUISet*, Feature*, QWidget*) sdrangel/plugins/feature/map/mapgui.cpp:265
    f4exb#3 0x7efe835372f4 in MapGUI::create(PluginAPI*, FeatureUISet*, Feature*) sdrangel/plugins/feature/map/mapgui.cpp:66
    f4exb#4 0x7efe834b5471 in MapPlugin::createFeatureGUI(FeatureUISet*, Feature*) const sdrangel/plugins/feature/map/mapplugin.cpp:72
    f4exb#5 0x7efeb6b416c2 in FeatureUISet::loadFeatureSetSettings(FeatureSetPreset const*, PluginAPI*, WebAPIAdapterInterface*, QList<Workspace*>*, Workspace*) sdrangel/sdrgui/feature/featureuiset.cpp:185
    f4exb#6 0x7efeb67e9b41 in MainWindow::loadConfiguration(Configuration const*, bool) sdrangel/sdrgui/mainwindow.cpp:1503
    f4exb#7 0x7efeb6730e3e in MainWindow::MainWindow(qtwebapp::LoggerWithFile*, MainParser const&, QWidget*) sdrangel/sdrgui/mainwindow.cpp:257
    f4exb#8 0x557281218bad in runQtApplication sdrangel/app/main.cpp:196
    f4exb#9 0x5572812194a3 in main sdrangel/app/main.cpp:248
    f4exb#10 0x7efeb10456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

and others
  • Loading branch information
dforsi committed May 19, 2024
1 parent b8b732a commit a732678
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/feature/map/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////

#include <QtAlgorithms>
#include <QResource>
#include <QFile>
#include <QRegularExpression>
Expand All @@ -41,6 +42,11 @@ WebServer::WebServer(quint16 &port, QObject* parent) :
m_mimeTypes.insert(".geojson", new MimeType("application/geo+json"));
}

WebServer::~WebServer()
{
qDeleteAll(m_mimeTypes);
}

void WebServer::incomingConnection(qintptr socket)
{
QTcpSocket* s = new QTcpSocket(this);
Expand Down
1 change: 1 addition & 0 deletions plugins/feature/map/webserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class WebServer : public QTcpServer

public:
WebServer(quint16 &port, QObject* parent = 0);
~WebServer();
void incomingConnection(qintptr socket) override;
void addPathSubstitution(const QString &from, const QString &to);
void addSubstitution(QString path, QString from, QString to);
Expand Down

0 comments on commit a732678

Please sign in to comment.