about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorWill Song <incertia9474@gmail.com>2015-01-12 23:00:03 -0600
committerWill Song <incertia9474@gmail.com>2015-01-12 23:00:03 -0600
commit12642656917ed3d33e1a82683c09d2136b8b01b1 (patch)
tree628d18ebb7acf7f602bea1e8aecb930ea68c08ea /src
parentb1f79b9d35a7d9b1ce2f782714020f14ce78b561 (diff)
downloadprofani-tty-12642656917ed3d33e1a82683c09d2136b8b01b1.tar.gz
fix a potential leak
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.c6
1 files 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;
 }