Skip to content

Commit

Permalink
Fix memory leaks
Browse files Browse the repository at this point in the history
* Fixes a couple of memory leaks (although not dangerous in practice, since we are talking about objects with a lifetime up to the end of the application)
* Fixes heap use after free

PR qbittorrent#19650.
Closes qbittorrent#19632.
  • Loading branch information
glassez authored Sep 27, 2023
1 parent cacae42 commit 46c1c9d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/base/http/requestparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ bool RequestParser::parseRequestLine(const QString &line)

if (sepPos >= 0)
{
const QByteArrayView query = url.mid(sepPos + 1);
const QByteArrayView query = QByteArrayView(url).mid(sepPos + 1);

// [rfc3986] 2.4 When to Encode or Decode
// URL components should be separated before percent-decoding
Expand Down
2 changes: 1 addition & 1 deletion src/base/torrentfileswatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void TorrentFilesWatcher::initWorker()
connect(m_asyncWorker, &TorrentFilesWatcher::Worker::torrentFound, this, &TorrentFilesWatcher::onTorrentFound);

m_asyncWorker->moveToThread(m_ioThread.get());
connect(m_ioThread.get(), &QThread::finished, this, [this] { delete m_asyncWorker; });
connect(m_ioThread.get(), &QObject::destroyed, this, [this] { delete m_asyncWorker; });
m_ioThread->start();

for (auto it = m_watchedFolders.cbegin(); it != m_watchedFolders.cend(); ++it)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/lineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent)
{
auto *action = new QAction(UIThemeManager::instance()->getIcon(u"edit-find"_s), QString());
auto *action = new QAction(UIThemeManager::instance()->getIcon(u"edit-find"_s), QString(), this);
addAction(action, QLineEdit::LeadingPosition);

setClearButtonEnabled(true);
Expand Down

0 comments on commit 46c1c9d

Please sign in to comment.