aboutsummaryrefslogtreecommitdiffstats
path: root/CommandScreen.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2021-01-11 20:43:27 +0100
committerDaniel Lange <DLange@git.local>2021-01-11 20:43:27 +0100
commitc55320e9e2a8916e911bcd39ab37b79e3a7d03b2 (patch)
treed6be9a09fdf7d6dc155de3429a70697ee2bb43b0 /CommandScreen.c
parent65357c8c46154de4e4eca14075bfe5523bb5fc14 (diff)
downloaddebian_htop-c55320e9e2a8916e911bcd39ab37b79e3a7d03b2.tar.gz
debian_htop-c55320e9e2a8916e911bcd39ab37b79e3a7d03b2.tar.bz2
debian_htop-c55320e9e2a8916e911bcd39ab37b79e3a7d03b2.zip
New upstream version 3.0.5upstream/3.0.5
Diffstat (limited to 'CommandScreen.c')
-rw-r--r--CommandScreen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/CommandScreen.c b/CommandScreen.c
index d342829..12b1987 100644
--- a/CommandScreen.c
+++ b/CommandScreen.c
@@ -17,9 +17,10 @@ static void CommandScreen_scan(InfoScreen* this) {
Panel_prune(panel);
const char* p = Process_getCommand(this->process);
- char* line = xMalloc(COLS + 1);
+ char line[COLS + 1];
int line_offset = 0, last_spc = -1, len;
for (; *p != '\0'; p++, line_offset++) {
+ assert(line_offset >= 0 && (size_t)line_offset < sizeof(line));
line[line_offset] = *p;
if (*p == ' ') {
last_spc = line_offset;
@@ -41,7 +42,6 @@ static void CommandScreen_scan(InfoScreen* this) {
InfoScreen_addLine(this, line);
}
- free(line);
Panel_setSelected(panel, idx);
}
@@ -60,7 +60,7 @@ const InfoScreenClass CommandScreen_class = {
CommandScreen* CommandScreen_new(Process* process) {
CommandScreen* this = AllocThis(CommandScreen);
- return (CommandScreen*) InfoScreen_init(&this->super, process, NULL, LINES - 3, " ");
+ return (CommandScreen*) InfoScreen_init(&this->super, process, NULL, LINES - 2, " ");
}
void CommandScreen_delete(Object* this) {

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