aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRayyan Ansari <rayyan@ansari.sh>2023-11-06 20:17:06 +0000
committerRayyan Ansari <rayyan@ansari.sh>2023-11-06 20:25:32 +0000
commit2b3bba512eed4df6a477b7abdf548e13e4fe0078 (patch)
tree862bd3b6359f85b9f5d18c209a23a90ecdc280d7
parent0e4d0823617240345cc8ac5f3703636d041c2df3 (diff)
Fix some memory leaks
Free some objects that were allocated with new but not deleted, and in one case, do not set a pointer to nullptr before deleting, as this results in a memory leak due to memory allocated not being freed.
-rw-r--r--src/frontend/qt_sdl/CameraManager.cpp1
-rw-r--r--src/frontend/qt_sdl/LocalMP.cpp2
-rw-r--r--src/frontend/qt_sdl/main.cpp5
3 files changed, 7 insertions, 1 deletions
diff --git a/src/frontend/qt_sdl/CameraManager.cpp b/src/frontend/qt_sdl/CameraManager.cpp
index 7f4db5d..cc532ff 100644
--- a/src/frontend/qt_sdl/CameraManager.cpp
+++ b/src/frontend/qt_sdl/CameraManager.cpp
@@ -146,6 +146,7 @@ CameraManager::~CameraManager()
// save settings here?
delete[] frameBuffer;
+ delete[] tempFrameBuffer;
}
void CameraManager::init()
diff --git a/src/frontend/qt_sdl/LocalMP.cpp b/src/frontend/qt_sdl/LocalMP.cpp
index 5613972..4b3a6a6 100644
--- a/src/frontend/qt_sdl/LocalMP.cpp
+++ b/src/frontend/qt_sdl/LocalMP.cpp
@@ -311,8 +311,8 @@ void DeInit()
MPQueue->detach();
}
- MPQueue = nullptr;
delete MPQueue;
+ MPQueue = nullptr;
}
void SetRecvTimeout(int timeout)
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp
index e96bb4b..f033e66 100644
--- a/src/frontend/qt_sdl/main.cpp
+++ b/src/frontend/qt_sdl/main.cpp
@@ -832,6 +832,7 @@ ScreenHandler::ScreenHandler(QWidget* widget)
ScreenHandler::~ScreenHandler()
{
mouseTimer->stop();
+ delete mouseTimer;
}
void ScreenHandler::screenSetupLayout(int w, int h)
@@ -1872,6 +1873,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
MainWindow::~MainWindow()
{
+ delete[] actScreenAspectTop;
+ delete[] actScreenAspectBot;
}
void MainWindow::closeEvent(QCloseEvent* event)
@@ -3376,6 +3379,8 @@ int main(int argc, char** argv)
int ret = melon.exec();
+ delete options;
+
emuThread->emuStop();
emuThread->wait();
delete emuThread;