[Github-comments] [geany/geany] Fix crash when plugin_set_key_group() is called several times by plugins (#1426)

Jiří Techet notifications at xxxxx
Sun Mar 12 11:32:56 UTC 2017


When plugin calls plugin_set_key_group() several times for the same
group (when creating keybindings dynamically and needs to reset them),
it crashes with the current code the second time it gets called.

The reason is that group->plugin_keys is an array into which entries of
group->key_items point and when calling

g_ptr_array_set_size(group->key_items, 0);

it calls free_key_binding() for every item - when these items are
deallocated by g_free(group->plugin_keys) previously, calls of
free_key_binding() reference an invalid memory.

Just first resizing group->key_items (and calling free_key_binding() for
its items) and freeing group->plugin_keys afterwards fixes the problem.
You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany/pull/1426

-- Commit Summary --

  * Fix crash when plugin_set_key_group() is called several times by plugins

-- File Changes --

    M src/keybindings.c (4)

-- Patch Links --

https://github.com/geany/geany/pull/1426.patch
https://github.com/geany/geany/pull/1426.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1426
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170312/ef2cc2cf/attachment.html>


More information about the Github-comments mailing list