From 71c068ad286f1493fc1c3cc106e14d5ed104eb2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 11 Sep 2020 20:14:56 +0200 Subject: [PATCH] Free movingBar memory on exit --- MetersPanel.c | 7 +++++++ MetersPanel.h | 2 ++ htop.c | 2 ++ 3 files changed, 11 insertions(+) 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);