[geany/geany] 045662: Free `accel_string` only after its last use (#2961)
Avinash Sonawane
git-noreply at xxxxx
Wed Oct 27 23:46:52 UTC 2021
Branch: refs/heads/master
Author: Avinash Sonawane <rootkea at gmail.com>
Committer: GitHub <noreply at github.com>
Date: Wed, 27 Oct 2021 23:46:52 UTC
Commit: 04566236d3f9811d55d6c7bcc492b3a60369fd20
https://github.com/geany/geany/commit/04566236d3f9811d55d6c7bcc492b3a60369fd20
Log Message:
-----------
Free `accel_string` only after its last use (#2961)
Found by: scan-build
Modified Paths:
--------------
src/editor.c
Modified: src/editor.c
4 lines changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -222,13 +222,15 @@ static void add_kb(GKeyFile *keyfile, const gchar *group, gchar **keys)
gchar *accel_string = g_key_file_get_value(keyfile, group, keys[i], NULL);
gtk_accelerator_parse(accel_string, &key, &mods);
- g_free(accel_string);
if (key == 0 && mods == 0)
{
g_warning("Can not parse accelerator \"%s\" from user snippets.conf", accel_string);
+ g_free(accel_string);
continue;
}
+ g_free(accel_string);
+
gtk_accel_group_connect(snippet_accel_group, key, mods, 0,
g_cclosure_new_swap((GCallback)on_snippet_keybinding_activate,
g_strdup(keys[i]), (GClosureNotify)g_free));
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list