diff options
author | Nathan Scott <nathans@redhat.com> | 2021-08-17 14:38:19 +1000 |
---|---|---|
committer | Nathan Scott <nathans@redhat.com> | 2021-08-17 14:41:40 +1000 |
commit | c401ac3a98563f84e1957445f4c5643186e0e9d3 (patch) | |
tree | 1f43c17ad890b1da80544473ea1b6ba9839f4bf3 /Action.c | |
parent | fefff80631e86f0296a2621a3699b16de60b86c6 (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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); } |