policy: kdbus_policy_set() use another variable to save entries
In kdbus_policy_set() function, we use the 'e' variable to reference
each entry of the 'db->entries_hash', so at the end the variable 'e' will
for sure point to a valid one.
Next in the KDBUS_ITEMS_FOREACH() iterator and if we fail at the first
KDBUS_ITEM_VALID() test, we jmp to exit:
Which contains the following:
if (e)
kdbus_policy_entry_free(e);
Here 'e' points to a valid entry and it will be freed, so even we
restore all the other entries from that list, there will be always one
missing, the last one pointed by that 'e' variable.
To fix this, just use another 'tmp_entry' variable to reference hash
entries.
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>