summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-09-11 20:14:56 +0200
committercgzones <cgzones@googlemail.com>2020-09-17 22:04:11 +0200
commit71c068ad286f1493fc1c3cc106e14d5ed104eb2a (patch)
tree0fb646b00aac8c79438be78af51dfcc33f1259c4
parent8a849bc85a1d59ffc77e6bff1aa3da2d4bcd746c (diff)
Free movingBar memory on exit
-rw-r--r--MetersPanel.c7
-rw-r--r--MetersPanel.h2
-rw-r--r--htop.c2
3 files changed, 11 insertions, 0 deletions
diff --git a/MetersPanel.c b/MetersPanel.c
index 417834a3..1e0afcdc 100644
--- a/MetersPanel.c
+++ b/MetersPanel.c
@@ -27,6 +27,13 @@ static const char* const MetersMovingKeys[] = {"Space", "Enter", "Up", "Dn", "<-
static int MetersMovingEvents[] = {' ', 13, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, ERR, KEY_DC, KEY_F(10)};
static FunctionBar* Meters_movingBar = NULL;
+void MetersPanel_cleanup() {
+ if (Meters_movingBar) {
+ FunctionBar_delete(Meters_movingBar);
+ Meters_movingBar = NULL;
+ }
+}
+
static void MetersPanel_delete(Object* object) {
Panel* super = (Panel*) object;
MetersPanel* this = (MetersPanel*) object;
diff --git a/MetersPanel.h b/MetersPanel.h
index c02ce1cd..dbc31ee4 100644
--- a/MetersPanel.h
+++ b/MetersPanel.h
@@ -24,6 +24,8 @@ struct MetersPanel_ {
bool moving;
};
+void MetersPanel_cleanup(void);
+
void MetersPanel_setMoving(MetersPanel* this, bool moving);
extern PanelClass MetersPanel_class;
diff --git a/htop.c b/htop.c
index 79526b88..8399d73e 100644
--- a/htop.c
+++ b/htop.c
@@ -12,6 +12,7 @@ in the source distribution for its full text.
#include "ColumnsPanel.h"
#include "CRT.h"
#include "MainPanel.h"
+#include "MetersPanel.h"
#include "ProcessList.h"
#include "ScreenManager.h"
#include "Settings.h"
@@ -277,6 +278,7 @@ int main(int argc, char** argv) {
ProcessList_delete(pl);
ScreenManager_delete(scr);
+ MetersPanel_cleanup();
UsersTable_delete(ut);
Settings_delete(settings);

© 2014-2024 Faster IT GmbH | imprint | privacy policy