forked from mirrors/linphone-iphone
fix leak memory
This commit is contained in:
parent
4f33de229f
commit
7183116b4b
8 changed files with 37 additions and 15 deletions
|
|
@ -174,7 +174,9 @@
|
|||
BOOL greyCellForGroupChat = _isGroupChat ? capabilities > 0 : TRUE;
|
||||
cell.userInteractionEnabled = cell.greyView.hidden = greyCellForEncryptedChat && greyCellForGroupChat;
|
||||
cell.displayNameLabel.text = [FastAddressBook displayNameForAddress:addr];
|
||||
cell.addressLabel.text = linphoneContact ? [NSString stringWithUTF8String:linphone_address_as_string(addr)] : phoneOrAddr;
|
||||
char *str = linphone_address_as_string(addr);
|
||||
cell.addressLabel.text = linphoneContact ? [NSString stringWithUTF8String:str] : phoneOrAddr;
|
||||
ms_free(str);
|
||||
cell.selectedImage.hidden = ![_contactsGroup containsObject:cell.addressLabel.text];
|
||||
[cell.avatarImage setImage:[FastAddressBook imageForAddress:addr] bordered:NO withRoundedRadius:YES];
|
||||
cell.contentView.userInteractionEnabled = false;
|
||||
|
|
|
|||
|
|
@ -362,7 +362,9 @@ void chat_room_subject_changed(LinphoneChatRoom *cr, const LinphoneEventLog *eve
|
|||
|
||||
void chat_room_participant_added(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
|
||||
ChatConversationInfoView *view = (__bridge ChatConversationInfoView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_current_callbacks(cr));
|
||||
NSString *participantAddress = [NSString stringWithUTF8String:linphone_address_as_string(linphone_event_log_get_participant_address(event_log))];
|
||||
char *str = linphone_address_as_string(linphone_event_log_get_participant_address(event_log));
|
||||
NSString *participantAddress = [NSString stringWithUTF8String:str];
|
||||
ms_free(str);
|
||||
[view.oldContacts addObject:participantAddress];
|
||||
[view.contacts addObject:participantAddress];
|
||||
[view.tableView reloadData];
|
||||
|
|
@ -370,7 +372,9 @@ void chat_room_participant_added(LinphoneChatRoom *cr, const LinphoneEventLog *e
|
|||
|
||||
void chat_room_participant_removed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
|
||||
ChatConversationInfoView *view = (__bridge ChatConversationInfoView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_current_callbacks(cr));
|
||||
NSString *participantAddress = [NSString stringWithUTF8String:linphone_address_as_string(linphone_event_log_get_participant_address(event_log))];
|
||||
char *str = linphone_address_as_string(linphone_event_log_get_participant_address(event_log));
|
||||
NSString *participantAddress = [NSString stringWithUTF8String:str];
|
||||
ms_free(str);
|
||||
[view.oldContacts removeObject:participantAddress];
|
||||
[view.contacts removeObject:participantAddress];
|
||||
[view.tableView reloadData];
|
||||
|
|
@ -378,7 +382,9 @@ void chat_room_participant_removed(LinphoneChatRoom *cr, const LinphoneEventLog
|
|||
|
||||
void chat_room_participant_admin_status_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
|
||||
ChatConversationInfoView *view = (__bridge ChatConversationInfoView *)linphone_chat_room_cbs_get_user_data(linphone_chat_room_get_current_callbacks(cr));
|
||||
NSString *participantAddress = [NSString stringWithUTF8String:linphone_address_as_string(linphone_event_log_get_participant_address(event_log))];
|
||||
char *str = linphone_address_as_string(linphone_event_log_get_participant_address(event_log));
|
||||
NSString *participantAddress = [NSString stringWithUTF8String:str];
|
||||
ms_free(str);
|
||||
|
||||
LinphoneParticipant *me = linphone_chat_room_get_me(cr);
|
||||
if (me && linphone_address_equal(linphone_participant_get_address(me), linphone_event_log_get_participant_address(event_log))) {
|
||||
|
|
|
|||
|
|
@ -766,12 +766,14 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
bctbx_list_t *participants = linphone_chat_room_get_participants(_chatRoom);
|
||||
while (participants) {
|
||||
LinphoneParticipant *participant = (LinphoneParticipant *)participants->data;
|
||||
NSString *uri = [NSString stringWithUTF8String:linphone_address_as_string_uri_only(linphone_participant_get_address(participant))];
|
||||
char *curi = linphone_address_as_string_uri_only(linphone_participant_get_address(participant));
|
||||
NSString *uri = [NSString stringWithUTF8String:curi];
|
||||
[contactsArray addObject:uri];
|
||||
|
||||
if(linphone_participant_is_admin(participant))
|
||||
[admins addObject:uri];
|
||||
participants = participants->next;
|
||||
ms_free(curi);
|
||||
}
|
||||
ChatConversationInfoView *view = VIEW(ChatConversationInfoView);
|
||||
view.create = FALSE;
|
||||
|
|
|
|||
|
|
@ -548,7 +548,6 @@
|
|||
}
|
||||
linphone_address_set_domain(linphoneAddress, [domain UTF8String]);
|
||||
linphone_address_set_display_name(linphoneAddress, (displayName.length ? displayName.UTF8String : NULL));
|
||||
const char *identity = linphone_address_as_string(linphoneAddress);
|
||||
const char *password = [accountPassword UTF8String];
|
||||
const char *ha1 = [accountHa1 UTF8String];
|
||||
|
||||
|
|
@ -613,8 +612,10 @@
|
|||
if (strcmp(password,"") == 0) {
|
||||
password = NULL;
|
||||
}
|
||||
|
||||
|
||||
char *identity = linphone_address_as_string(linphoneAddress);
|
||||
LinphoneAddress *from = linphone_core_interpret_url(LC, identity);
|
||||
ms_free(identity);
|
||||
if (from) {
|
||||
const char *userid_str = (userID != nil) ? [userID UTF8String] : NULL;
|
||||
LinphoneAuthInfo *info;
|
||||
|
|
|
|||
|
|
@ -42,8 +42,10 @@
|
|||
}
|
||||
[_securityButton setImage:[FastAddressBook imageForSecurityLevel:linphone_participant_device_get_security_level(_device)] forState:UIControlStateNormal];
|
||||
|
||||
char *uri = linphone_address_as_string_uri_only(linphone_participant_device_get_address(_device));
|
||||
_deviceLabel.text = [NSString stringWithUTF8String:linphone_participant_device_get_name(_device) ? :
|
||||
linphone_address_as_string_uri_only(linphone_participant_device_get_address(_device))];
|
||||
uri];
|
||||
ms_free(uri);
|
||||
if (_isOneToOne) {
|
||||
CGRect frame =_deviceLabel.frame;
|
||||
frame.origin.x = 30;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@
|
|||
if (default_proxy != NULL) {
|
||||
const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(default_proxy);
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
_addressLabel.text = addr? [NSString stringWithUTF8String:linphone_address_as_string(addr)] : NSLocalizedString(@"No address", nil);
|
||||
char *str = addr ? linphone_address_as_string(addr) : nil;
|
||||
_addressLabel.text = str ? [NSString stringWithUTF8String:str] : NSLocalizedString(@"No address", nil);
|
||||
if (str) ms_free(str);
|
||||
_presenceImage.image = [StatusBarView imageForState:linphone_proxy_config_get_state(default_proxy)];
|
||||
} else {
|
||||
_nameLabel.text = linphone_core_get_proxy_config_list(LC) ? NSLocalizedString(@"No default account", nil) : NSLocalizedString(@"No account", nil);
|
||||
|
|
|
|||
|
|
@ -90,8 +90,9 @@
|
|||
if (cfg) {
|
||||
const char *normvalue = linphone_proxy_config_normalize_phone_number(cfg, phone.UTF8String);
|
||||
LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri(cfg, normvalue);
|
||||
const char *phone_addr = linphone_address_as_string_uri_only(addr);
|
||||
char *phone_addr = linphone_address_as_string_uri_only(addr);
|
||||
contact = [FastAddressBook getContact:[NSString stringWithUTF8String:phone_addr]];
|
||||
ms_free(phone_addr);
|
||||
} else {
|
||||
contact = [FastAddressBook getContact:phone];
|
||||
}
|
||||
|
|
@ -602,10 +603,13 @@
|
|||
if (displayName == nil) return;
|
||||
|
||||
const LinphonePresenceModel *m = [[k.userInfo valueForKey:@"presence_model"] pointerValue];
|
||||
if (!linphone_presence_model_get_contact(m)) {
|
||||
char *str = linphone_presence_model_get_contact(m);
|
||||
if (str == nil) {
|
||||
return;
|
||||
}
|
||||
NSString *contact = [NSString stringWithUTF8String:linphone_presence_model_get_contact(m)];
|
||||
|
||||
NSString *contact = [NSString stringWithUTF8String:str];
|
||||
ms_free(str);
|
||||
NSString *sipAddr = [FastAddressBook normalizeSipURI:contact];
|
||||
|
||||
if (sipAddr != nil && [displayNames objectForKey:sipAddr] == nil) {
|
||||
|
|
|
|||
|
|
@ -472,9 +472,10 @@
|
|||
const LinphonePresenceModel *m = f
|
||||
? linphone_friend_get_presence_model_for_uri_or_tel(f, value.UTF8String)
|
||||
: NULL;
|
||||
const char *contact = m ? linphone_presence_model_get_contact(m) : NULL;
|
||||
char *contact = m ? linphone_presence_model_get_contact(m) : NULL;
|
||||
if (contact) {
|
||||
LinphoneAddress *contact_addr = linphone_address_new(contact);
|
||||
ms_free(contact);
|
||||
if (contact_addr) {
|
||||
linphone_address_unref(addr);
|
||||
return contact_addr;
|
||||
|
|
@ -617,17 +618,19 @@
|
|||
+ (void)setDisplayNameLabel:(UILabel *)label forAddress:(const LinphoneAddress *)addr withAddressLabel:(UILabel*)addressLabel{
|
||||
Contact *contact = [FastAddressBook getContactWithAddress:addr];
|
||||
NSString *tmpAddress = nil;
|
||||
char *uri = linphone_address_as_string_uri_only(addr);
|
||||
if (contact) {
|
||||
[ContactDisplay setDisplayNameLabel:label forContact:contact];
|
||||
tmpAddress = [NSString stringWithUTF8String:linphone_address_as_string_uri_only(addr)];
|
||||
tmpAddress = [NSString stringWithUTF8String:uri];
|
||||
addressLabel.hidden = FALSE;
|
||||
} else {
|
||||
label.text = [FastAddressBook displayNameForAddress:addr];
|
||||
if([LinphoneManager.instance lpConfigBoolForKey:@"display_phone_only" inSection:@"app"])
|
||||
addressLabel.hidden = TRUE;
|
||||
else
|
||||
tmpAddress = [NSString stringWithUTF8String:linphone_address_as_string_uri_only(addr)];
|
||||
tmpAddress = [NSString stringWithUTF8String:uri];
|
||||
}
|
||||
ms_free(uri);
|
||||
NSRange range = [tmpAddress rangeOfString:@";"];
|
||||
if (range.location != NSNotFound) {
|
||||
tmpAddress = [tmpAddress substringToIndex:range.location];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue