libgimpbase: Correctly free duplicate nicks in GimpChoice

A crash could happen when a duplicate nick was found due to incorrectly
freeing the content of 'choice->keys' which holds the nicks and not
GimpChoiceDesc. Instead, the nick needs to be simply freed.
This commit is contained in:
Ondřej Míchal 2025-06-18 14:17:55 +03:00
parent 06d8bd6c54
commit 2f76be13cb

View file

@ -204,8 +204,7 @@ gimp_choice_add (GimpChoice *choice,
if (duplicate != NULL)
{
choice->keys = g_list_remove_link (choice->keys, duplicate);
gimp_choice_desc_free (duplicate->data);
g_list_free (duplicate);
g_free (duplicate->data);
}
choice->keys = g_list_append (choice->keys, g_strdup (nick));
}