mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 21:16:22 +00:00
Free OTR TLVS
This commit is contained in:
@@ -708,6 +708,14 @@ otr_encrypt_message(const char * const to, const char * const message)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_otr_tlv_free(OtrlTLV *tlvs)
|
||||
{
|
||||
if (tlvs) {
|
||||
otrl_tlv_free(tlvs);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
otr_decrypt_message(const char * const from, const char * const message, gboolean *was_decrypted)
|
||||
{
|
||||
@@ -723,7 +731,6 @@ otr_decrypt_message(const char * const from, const char * const message, gboolea
|
||||
// common tlv handling
|
||||
OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
|
||||
if (tlv) {
|
||||
|
||||
if (context) {
|
||||
otrl_context_force_plaintext(context);
|
||||
ui_gone_insecure(from);
|
||||
@@ -732,16 +739,19 @@ otr_decrypt_message(const char * const from, const char * const message, gboolea
|
||||
|
||||
// library version specific tlv handling
|
||||
otrlib_handle_tlvs(user_state, &ops, context, tlvs, smp_initiators);
|
||||
_otr_tlv_free(tlvs);
|
||||
|
||||
return NULL;
|
||||
|
||||
// message was decrypted, return to user
|
||||
} else if (decrypted) {
|
||||
_otr_tlv_free(tlvs);
|
||||
*was_decrypted = TRUE;
|
||||
return decrypted;
|
||||
|
||||
// normal non OTR message
|
||||
} else {
|
||||
_otr_tlv_free(tlvs);
|
||||
*was_decrypted = FALSE;
|
||||
return strdup(message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user