}
struct udev_event *udev_event_free(struct udev_event *event) {
- void *p;
-
if (!event)
return NULL;
sd_device_unref(event->dev);
sd_device_unref(event->dev_db_clone);
sd_netlink_unref(event->rtnl);
- while ((p = hashmap_steal_first_key(event->run_list)))
- free(p);
- hashmap_free(event->run_list);
+ hashmap_free_free_key(event->run_list);
hashmap_free_free_free(event->seclabel_list);
free(event->program_result);
free(event->name);
case TK_A_RUN_PROGRAM: {
_cleanup_free_ char *cmd = NULL;
- if (IN_SET(cur->key.op, OP_ASSIGN, OP_ASSIGN_FINAL)) {
- void *p;
-
- while ((p = hashmap_steal_first_key(event->run_list)))
- free(p);
- }
+ if (IN_SET(cur->key.op, OP_ASSIGN, OP_ASSIGN_FINAL))
+ hashmap_clear_free_key(event->run_list);
r = hashmap_ensure_allocated(&event->run_list, NULL);
if (r < 0)