Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
None
Description
When lf_delete() — for example — searches in the hash it may need to allocate and insert a new dummy node, the latter may fail with OOM. The caller normally doesn't expect OOM from searches or deletes and it's not always easy to handle OOM there.
Instead lf_delete() and lf_search() can be changed never to return OOM. Indeed, when a search cannot insert a new dummy node, it simply needs to start searching from the previous dummy node, which is guaranteed to exist.
It's even easier in lf_hash_iterate() — it only ever looks for the very first bucket, dummy node 0. If that node does not exists, the hash is most certainly empty.