mirror of
https://github.com/xzeldon/htop.git
synced 2025-04-11 04:57:07 +03:00
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.
This commit is contained in:
parent
4ef5e4296e
commit
0e58784224
@ -77,6 +77,7 @@ void Settings_delete(Settings* this) {
|
|||||||
for (unsigned int i = 0; this->screens[i]; i++) {
|
for (unsigned int i = 0; this->screens[i]; i++) {
|
||||||
free(this->screens[i]->name);
|
free(this->screens[i]->name);
|
||||||
free(this->screens[i]->fields);
|
free(this->screens[i]->fields);
|
||||||
|
free(this->screens[i]);
|
||||||
}
|
}
|
||||||
free(this->screens);
|
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* 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->name = xStrdup(name);
|
||||||
ss->fields = xCalloc(LAST_PROCESSFIELD, sizeof(ProcessField));
|
ss->fields = xCalloc(LAST_PROCESSFIELD, sizeof(ProcessField));
|
||||||
ss->flags = 0;
|
ss->flags = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user