Hi, there seems to be a memory leak in systat where the help text buffer
is not freed under some circumstances. As a result, repeatedly pressing,
for example, 'h' and 'space' keys will cause it to leak memory. Also
entering command mode with an active help text will leak the text. The
following diff fixes it.

Index: engine.c
===================================================================
RCS file: /cvs/src/usr.bin/systat/engine.c,v
retrieving revision 1.26
diff -u -p -r1.26 engine.c
--- engine.c    9 Jan 2021 12:49:09 -0000       1.26
+++ engine.c    6 Feb 2021 03:07:37 -0000
@@ -1139,7 +1139,7 @@ command_set(struct command *cmd, const c
                        cmdbuf[0] = 0;
                }
        }
-       curr_message = NULL;
+       message_set(NULL);
        curr_cmd = cmd;
        need_update = 1;
        return prev;
@@ -1235,7 +1235,7 @@ keyboard(void)

        if (curr_message != NULL) {
                if (ch > 0) {
-                       curr_message = NULL;
+                       message_set(NULL);
                        need_update = 1;
                }
        }

ok?

Regards,
Anindya

Reply via email to