diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index 91fac588c..ad3447da1 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -306,7 +306,10 @@ bctbx_list_t * linphone_chat_room_get_composing_addresses(LinphoneChatRoom *cr) } LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, const LinphoneContent *initial_content) { - return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->createFileTransferMessage(initial_content)); + shared_ptr cppPtr = L_GET_CPP_PTR_FROM_C_OBJECT(cr)->createFileTransferMessage(initial_content); + LinphoneChatMessage *object = L_INIT(ChatMessage); + L_SET_CPP_PTR_FROM_C_OBJECT(object, cppPtr); + return object; } // =============================================================================