summaryrefslogtreecommitdiffstats
path: root/Settings.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-11-05 09:13:13 +1100
committerNathan Scott <nathans@redhat.com>2021-12-07 17:04:49 +1100
commit0e58784224ede880e6201d23d3b280e378ccefb8 (patch)
tree4fad22f13a35a5c66652cf5ad1ceeb71c9eb4cdb /Settings.c
parent4ef5e4296ed183a2e1cc75925ea813467634c558 (diff)
Fix memory leak on shutdown in new screen settings code.
Also tidy up the calloc call parameters in the initial allocation of this pointer, thanks to @BenBE for noticing.
Diffstat (limited to 'Settings.c')
-rw-r--r--Settings.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Settings.c b/Settings.c
index e587537d..94b4003c 100644
--- a/Settings.c
+++ b/Settings.c
@@ -77,6 +77,7 @@ void Settings_delete(Settings* this) {
for (unsigned int i = 0; this->screens[i]; i++) {
free(this->screens[i]->name);
free(this->screens[i]->fields);
+ free(this->screens[i]);
}
free(this->screens);
}
@@ -262,7 +263,7 @@ static void ScreenSettings_readFields(ScreenSettings* ss, Hashtable* columns, co
}
ScreenSettings* Settings_newScreen(Settings* this, const char* name, const char* line) {
- ScreenSettings* ss = xCalloc(sizeof(ScreenSettings), 1);
+ ScreenSettings* ss = xCalloc(1, sizeof(ScreenSettings));
ss->name = xStrdup(name);
ss->fields = xCalloc(LAST_PROCESSFIELD, sizeof(ProcessField));
ss->flags = 0;

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