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) {