summaryrefslogtreecommitdiffstats
path: root/Action.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-08-17 14:38:19 +1000
committerNathan Scott <nathans@redhat.com>2021-08-17 14:41:40 +1000
commitc401ac3a98563f84e1957445f4c5643186e0e9d3 (patch)
tree1f43c17ad890b1da80544473ea1b6ba9839f4bf3 /Action.c
parentfefff80631e86f0296a2621a3699b16de60b86c6 (diff)
Ensure DynamicColumn hash lookups never see NULL pointers
This cannot happen in these code locations, but for the purposes of static checkers like Coverity scan (and for future proofing), add two more guards on NULL hash table entry pointers.
Diffstat (limited to 'Action.c')
-rw-r--r--Action.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Action.c b/Action.c
index 5d774587..6e804f68 100644
--- a/Action.c
+++ b/Action.c
@@ -174,8 +174,9 @@ static Htop_Reaction actionSetSortColumn(State* st) {
char* name = NULL;
if (fields[i] >= LAST_PROCESSFIELD) {
DynamicColumn* column = Hashtable_get(dynamicColumns, fields[i]);
- if (column)
- name = xStrdup(column->caption ? column->caption : column->name);
+ if (column == NULL)
+ continue;
+ name = xStrdup(column->caption ? column->caption : column->name);
} else {
name = String_trim(Process_fields[fields[i]].name);
}

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