Fixed memleaks with otr policy and autoaway options

This commit is contained in:
James Booth
2014-06-17 23:34:52 +01:00
parent ad68bcfde2
commit 79ddf10484
5 changed files with 25 additions and 11 deletions

View File

@@ -1413,10 +1413,13 @@ cmd_execute_default(const char * const inp)
ui_current_print_line("You are not currently connected.");
} else {
#ifdef HAVE_LIBOTR
if ((strcmp(otr_get_policy(recipient), "always") == 0) && !otr_is_secure(recipient)) {
char *policy = otr_get_policy(recipient);
if ((strcmp(policy, "always") == 0) && !otr_is_secure(recipient)) {
cons_show_error("Failed to send message. Please check OTR policy");
free(policy);
return TRUE;
}
free(policy);
if (otr_is_secure(recipient)) {
char *encrypted = otr_encrypt_message(recipient, inp);
if (encrypted != NULL) {

View File

@@ -1033,6 +1033,7 @@ cmd_msg(gchar **args, struct cmd_help_t help)
message_send(msg, usr_jid);
}
ui_outgoing_msg("me", usr_jid, msg);
free(policy);
if (((win_type == WIN_CHAT) || (win_type == WIN_CONSOLE)) && prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid();