In case of an error a varname id is set to 0. Ideally, it shouldn't be
found in the hash table lookup but add a check anyway to avoid obtaining
the mutex lock and performing the lookup.
void VarNameStoreUnregister(const uint32_t id, const enum VarTypes type)
{
+ if (unlikely(id == 0)) {
+ /* There was an error registering the varname, so nothing to unregister */
+ return;
+ }
SCMutexLock(&base_lock);
VariableName lookup = { .type = type, .id = id };
VariableName *found = (VariableName *)HashListTableLookup(base.ids, (void *)&lookup, 0);