1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

fix the fix (memory leak)

the "fix a potential leak" from Will Song is not fully addressing the
issue.. so now the "def" variable should definitely being freed
This commit is contained in:
Simon Effenberg 2015-01-14 08:15:15 +01:00
parent e19d57779f
commit 6f55d06e2b

View File

@ -93,7 +93,6 @@ cmd_connect(gchar **args, struct cmd_help_t help)
} else { } else {
gchar *opt_keys[] = { "server", "port", NULL }; gchar *opt_keys[] = { "server", "port", NULL };
gboolean parsed; gboolean parsed;
char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
GHashTable *options = parse_options(&args[args[0] ? 1 : 0], opt_keys, &parsed); GHashTable *options = parse_options(&args[args[0] ? 1 : 0], opt_keys, &parsed);
if (!parsed) { if (!parsed) {
@ -115,16 +114,19 @@ cmd_connect(gchar **args, struct cmd_help_t help)
} }
char *user = args[0]; char *user = args[0];
char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
if(!user){ if(!user){
if(def){ if(def){
user = def; user = def;
cons_show("Using default account %s.", user); cons_show("Using default account %s.", user);
} else { } else {
cons_show("No default account."); cons_show("No default account.");
g_free(def);
return TRUE; return TRUE;
} }
} }
g_free(def); g_free(def);
def = NULL;
char *lower = g_utf8_strdown(user, -1); char *lower = g_utf8_strdown(user, -1);
char *jid; char *jid;