map: don't mix insert_at() and _remove()

You are supposed to allocate with _insert_new()/_remove() or use
someone elses allocated number with _insert_at(), never mix the
two or it will give an error.
This commit is contained in:
Wim Taymans 2021-10-28 09:34:36 +02:00
parent f6b1d65e35
commit f39f9b207b
2 changed files with 3 additions and 3 deletions

View file

@ -1067,10 +1067,10 @@ static void pw_impl_port_remove(struct pw_impl_port *port)
}
if (port->direction == PW_DIRECTION_INPUT) {
pw_map_remove(&node->input_port_map, port->port_id);
pw_map_insert_at(&node->input_port_map, port->port_id, NULL);
node->info.n_input_ports--;
} else {
pw_map_remove(&node->output_port_map, port->port_id);
pw_map_insert_at(&node->output_port_map, port->port_id, NULL);
node->info.n_output_ports--;
}

View file

@ -369,7 +369,7 @@ static int destroy_global(void *obj, void *data)
if (global == NULL)
return 0;
pw_map_remove(&global->rd->globals, global->id);
pw_map_insert_at(&global->rd->globals, global->id, NULL);
pw_properties_free(global->properties);
free(global->type);
free(global);