aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-06 20:03:57 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-02-06 20:03:57 +0100
commit9634200c1041eca1c7ac0ce25d79bb8d961530f6 (patch)
tree4e533a614caeda557d68e07754a5f97de55aa50e /qtmips_gui
parent16a9ee3b5ef4cbeb3a43bb0b4e243c655e6da761 (diff)
downloadqtmips-9634200c1041eca1c7ac0ce25d79bb8d961530f6.tar.gz
qtmips-9634200c1041eca1c7ac0ce25d79bb8d961530f6.tar.bz2
qtmips-9634200c1041eca1c7ac0ce25d79bb8d961530f6.zip
Resolve some memory leaks found by Valgrind.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/cacheview.cpp9
-rw-r--r--qtmips_gui/memoryview.cpp1
2 files changed, 6 insertions, 4 deletions
diff --git a/qtmips_gui/cacheview.cpp b/qtmips_gui/cacheview.cpp
index 24b8d7b..d279083 100644
--- a/qtmips_gui/cacheview.cpp
+++ b/qtmips_gui/cacheview.cpp
@@ -210,11 +210,12 @@ CacheViewBlock::CacheViewBlock(const machine::Cache *cache, unsigned block , boo
}
CacheViewBlock::~CacheViewBlock() {
- delete validity;
- delete dirty;
- delete tag;
+ delete[] validity;
+ if (dirty != nullptr)
+ delete[] dirty;
+ delete[] tag;
for (unsigned y = 0; y < rows; y++)
- delete data[y];
+ delete[] data[y];
delete data;
}
diff --git a/qtmips_gui/memoryview.cpp b/qtmips_gui/memoryview.cpp
index 9bc0b0c..0457633 100644
--- a/qtmips_gui/memoryview.cpp
+++ b/qtmips_gui/memoryview.cpp
@@ -47,6 +47,7 @@
MemoryView::MemoryView(QWidget *parent, std::uint32_t addr0) : QWidget(parent) {
memory = nullptr;
addr_0 = addr0;
+ change_counter = 0;
layout = new QVBoxLayout(this);