diff options
author | Steffen Jaeckel <jaeckel-floss@eyet-services.de> | 2022-12-30 19:36:53 +0100 |
---|---|---|
committer | Steffen Jaeckel <jaeckel-floss@eyet-services.de> | 2023-01-18 20:11:13 +0100 |
commit | e886ba0c6fed433b561c4d0efb4f91b0681aa788 (patch) | |
tree | 24a674bb737d5303ecd755e6f3c03a7407ad9ee1 /src/command | |
parent | 698aefa005d5a74b2570f6ce17f2d7712bff3e4e (diff) | |
download | profani-tty-e886ba0c6fed433b561c4d0efb4f91b0681aa788.tar.gz |
fix more memory leaks
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_ac.c | 4 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 559b3bda..e48e0ae2 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -2849,7 +2849,7 @@ _omemo_autocomplete(ProfWin* window, const char* const input, gboolean previous) gboolean result; gchar** args = parse_args(input, 2, 3, &result); if (result) { - gchar* jid = g_strdup(args[1]); + auto_gchar gchar* jid = g_strdup(args[1]); found = autocomplete_param_no_with_func(input, "/omemo trust", 4, omemo_fingerprint_autocomplete, previous, jid); if (found) { return found; @@ -2876,7 +2876,7 @@ _omemo_autocomplete(ProfWin* window, const char* const input, gboolean previous) gboolean result; gchar** args = parse_args(input, 2, 3, &result); if (result) { - gchar* jid = g_strdup(args[1]); + auto_gchar gchar* jid = g_strdup(args[1]); found = autocomplete_param_no_with_func(input, "/omemo untrust", 4, omemo_fingerprint_autocomplete, previous, jid); if (found) { return found; diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index bbfb3cb8..56a18bdb 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -8436,18 +8436,19 @@ _cmd_execute(ProfWin* window, const char* const command, const char* const inp) int i = 0; while (cmd->sub_funcs[i].cmd) { if (g_strcmp0(args[0], (char*)cmd->sub_funcs[i].cmd) == 0) { - gboolean result = cmd->sub_funcs[i].func(window, command, args); - g_strfreev(args); - return result; + result = cmd->sub_funcs[i].func(window, command, args); + goto out; } i++; } } if (!cmd->func) { ui_invalid_command_usage(cmd->cmd, cmd->setting_func); - return TRUE; + result = TRUE; + goto out; } - gboolean result = cmd->func(window, command, args); + result = cmd->func(window, command, args); +out: g_strfreev(args); return result; } else if (plugins_run_command(inp)) { @@ -8887,6 +8888,7 @@ cmd_omemo_fingerprint(ProfWin* window, const char* const command, gchar** args) free(formatted_fingerprint); } + jid_destroy(jid); g_list_free(fingerprints); win_println(window, THEME_DEFAULT, "-", "You can trust it with '/omemo trust <fingerprint>'"); |