mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-28 01:16:21 +00:00
Only use enc_char in win_print_incoming() when needed
Fixes potential memory leak too.
This commit is contained in:
@@ -1101,7 +1101,6 @@ _win_correct(ProfWin *window, const char *const message, const char *const id, c
|
|||||||
void
|
void
|
||||||
win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMessage *message)
|
win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMessage *message)
|
||||||
{
|
{
|
||||||
char *enc_char = strdup("-");
|
|
||||||
int flags = NO_ME;
|
int flags = NO_ME;
|
||||||
|
|
||||||
if (!message->trusted) {
|
if (!message->trusted) {
|
||||||
@@ -1112,7 +1111,9 @@ win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMes
|
|||||||
{
|
{
|
||||||
case WIN_CHAT:
|
case WIN_CHAT:
|
||||||
{
|
{
|
||||||
|
char *enc_char;
|
||||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
|
|
||||||
if (chatwin->incoming_char) {
|
if (chatwin->incoming_char) {
|
||||||
enc_char = strdup(chatwin->incoming_char);
|
enc_char = strdup(chatwin->incoming_char);
|
||||||
} else if (message->enc == PROF_MSG_ENC_OTR) {
|
} else if (message->enc == PROF_MSG_ENC_OTR) {
|
||||||
@@ -1121,6 +1122,8 @@ win_print_incoming(ProfWin *window, const char *const display_name_from, ProfMes
|
|||||||
enc_char = prefs_get_pgp_char();
|
enc_char = prefs_get_pgp_char();
|
||||||
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
|
} else if (message->enc == PROF_MSG_ENC_OMEMO) {
|
||||||
enc_char = prefs_get_omemo_char();
|
enc_char = prefs_get_omemo_char();
|
||||||
|
} else {
|
||||||
|
enc_char = strdup("-");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_CORRECTION_ALLOW) && message->replace_id) {
|
if (prefs_get_boolean(PREF_CORRECTION_ALLOW) && message->replace_id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user