mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
fix memory leak and crash in test suite
This commit is contained in:
parent
09c5af9840
commit
2b93067a78
2 changed files with 5 additions and 6 deletions
|
|
@ -1098,7 +1098,7 @@ static void linphone_chat_room_send_is_composing_notification(LinphoneChatRoom *
|
|||
msg = linphone_chat_room_create_message(cr, content);
|
||||
linphone_chat_message_set_from_address(msg, from_addr);
|
||||
linphone_chat_message_set_to_address(msg, to_addr);
|
||||
msg->content_type = ms_strdup("application/im-iscomposing+xml");
|
||||
linphone_chat_message_set_content_type(msg, "application/im-iscomposing+xml");
|
||||
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
|
|
|
|||
|
|
@ -2308,7 +2308,7 @@ static int im_encryption_engine_process_incoming_message_cb(LinphoneImEncryption
|
|||
ms_free (msg->message);
|
||||
output[b64Size] = '\0';
|
||||
msg->message = (char *)output;
|
||||
msg->content_type = ms_strdup("text/plain");
|
||||
linphone_chat_message_set_content_type(msg, "text/plain");
|
||||
return 0;
|
||||
} else if (strcmp(msg->content_type, "text/plain") == 0) {
|
||||
return -1; // Not encrypted, nothing to do
|
||||
|
|
@ -2321,16 +2321,15 @@ static int im_encryption_engine_process_incoming_message_cb(LinphoneImEncryption
|
|||
|
||||
static int im_encryption_engine_process_outgoing_message_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
if (strcmp(msg->content_type,"text/plain") == 0) {
|
||||
size_t b64Size;
|
||||
size_t b64Size = 0;
|
||||
unsigned char *output;
|
||||
bctbx_base64_encode(NULL, &b64Size, (unsigned char *)msg->message, strlen(msg->message));
|
||||
output = (unsigned char *)ms_malloc(b64Size+1),
|
||||
output = (unsigned char *)ms_malloc0(b64Size+1),
|
||||
bctbx_base64_encode(output, &b64Size, (unsigned char *)msg->message, strlen(msg->message));
|
||||
ms_free (msg->message);
|
||||
output[b64Size] = '\0';
|
||||
msg->message = (char *)output;
|
||||
ms_free(msg->content_type);
|
||||
msg->content_type = ms_strdup("cipher/b64");
|
||||
linphone_chat_message_set_content_type(msg, "cipher/b64");
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue