summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Feck <cfeck@kde.org>2017-02-19 04:15:52 (GMT)
committerChristoph Feck <cfeck@kde.org>2017-02-19 04:15:52 (GMT)
commite4c58c2f6ef74bad065f7327c19c02a3dac88883 (patch)
tree9deb58fc8e49048204347fdec371a0d40a02ef7e
parent01a231bbfcf70f1ff91c510dc62aee1369b2a021 (diff)
Fix array allocation for non-continuous cpu numbers
BUG: 376537 FIXED-IN: 5.8.6 Differential Revision: https://phabricator.kde.org/D4640
-rw-r--r--ksysguardd/Linux/stat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ksysguardd/Linux/stat.c b/ksysguardd/Linux/stat.c
index 534a465..65d08b3 100644
--- a/ksysguardd/Linux/stat.c
+++ b/ksysguardd/Linux/stat.c
@@ -524,7 +524,8 @@ void initStat( struct SensorModul* sm ) {
int id;
sscanf( tag + 3, "%d", &id );
- CPUCount++;
+ if ( CPUCount < id + 1 )
+ CPUCount = id + 1;
sprintf( cmdName, "cpu/cpu%d/user", id );
registerMonitor( cmdName, "float", printCPUxUser, printCPUxUserInfo, StatSM );
sprintf( cmdName, "cpu/cpu%d/nice", id );