GUACAMOLE-313: Merge ensure keydef structure is freed in all cases.

This commit is contained in:
Nick Couchman 2018-01-30 19:04:22 -05:00
commit b1d050285a

View File

@ -219,14 +219,19 @@ int guaclog_state_update_key(guaclog_state* state, int keysym, bool pressed) {
/* Update tracked key state for modifiers */ /* Update tracked key state for modifiers */
if (keydef->modifier) { if (keydef->modifier) {
/* Keydef will be automatically freed if successfully added to state */
if (guaclog_state_add_key(state, keydef, pressed)) if (guaclog_state_add_key(state, keydef, pressed))
guaclog_keydef_free(keydef); guaclog_keydef_free(keydef);
else else
guaclog_state_trim_keys(state); guaclog_state_trim_keys(state);
return 0;
} }
/* Output key states only for printable keys */ /* Output key states only for printable keys */
else if (pressed) { if (pressed) {
if (guaclog_state_is_shortcut(state)) { if (guaclog_state_is_shortcut(state)) {
@ -260,6 +265,7 @@ int guaclog_state_update_key(guaclog_state* state, int keysym, bool pressed) {
} }
guaclog_keydef_free(keydef);
return 0; return 0;
} }