From 12642656917ed3d33e1a82683c09d2136b8b01b1 Mon Sep 17 00:00:00 2001 From: Will Song Date: Mon, 12 Jan 2015 23:00:03 -0600 Subject: [PATCH] fix a potential leak --- src/command/commands.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/command/commands.c b/src/command/commands.c index d6a8af2f..2f61b6fa 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -84,7 +84,6 @@ gboolean cmd_connect(gchar **args, struct cmd_help_t help) { gboolean result = FALSE; - char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT); jabber_conn_status_t conn_status = jabber_get_connection_status(); @@ -94,6 +93,7 @@ cmd_connect(gchar **args, struct cmd_help_t help) } else { gchar *opt_keys[] = { "server", "port", NULL }; gboolean parsed; + char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT); GHashTable *options = parse_options(&args[args[0] ? 1 : 0], opt_keys, &parsed); if (!parsed) { @@ -124,6 +124,8 @@ cmd_connect(gchar **args, struct cmd_help_t help) return TRUE; } } + g_free(def); + char *lower = g_utf8_strdown(user, -1); char *jid; @@ -176,8 +178,6 @@ cmd_connect(gchar **args, struct cmd_help_t help) result = TRUE; } - g_free(def); - return result; }