summaryrefslogtreecommitdiffstats
path: root/Process.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2021-05-17 23:15:24 +0200
committerBenBE <BenBE@geshi.org>2021-05-23 09:22:21 +0200
commit7ef58f2dcf03edb2822c3d95991590bb429f36ab (patch)
treea353ce2f74ee68a66c8cbd4bb3875bb06d609024 /Process.c
parent2824e2989a9bb85d500d347abb082a27a243de3c (diff)
Drop mc->maxLen field
Diffstat (limited to 'Process.c')
-rw-r--r--Process.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Process.c b/Process.c
index 0eba1215..c2a2ed17 100644
--- a/Process.c
+++ b/Process.c
@@ -425,7 +425,12 @@ void Process_makeCommandStr(Process *this) {
if (mc->cmdlineChanged || mc->commChanged || mc->exeChanged) {
free(mc->str);
/* Accommodate the column text, two field separators and terminating NUL */
- mc->str = xCalloc(1, mc->maxLen + 2 * SEPARATOR_LEN + 1);
+ size_t maxLen = 2 * SEPARATOR_LEN + 1;
+ maxLen += this->cmdline ? strlen(this->cmdline) : strlen("(zombie)");
+ maxLen += this->procComm ? strlen(this->procComm) : 0;
+ maxLen += this->procExe ? strlen(this->procExe) : 0;
+
+ mc->str = xCalloc(1, maxLen);
}
/* Preserve the settings used in this run */

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