diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index 2f882f1df..7ed6ea3a3 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -392,13 +392,12 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [waitView setHidden:TRUE]; if (error) { [LinphoneLogger log:LinphoneLoggerError format:@"Cannot save image data downloaded [%@]", [error localizedDescription]]; - - UIAlertView* errorAlert = [UIAlertView alloc]; - [errorAlert initWithTitle:NSLocalizedString(@"Transfer error", nil) - message:NSLocalizedString(@"Cannot write image to photo library", nil) - delegate:nil - cancelButtonTitle:NSLocalizedString(@"Ok",nil) - otherButtonTitles:nil ,nil]; + + UIAlertView* errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Transfer error", nil) + message:NSLocalizedString(@"Cannot write image to photo library", nil) + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Ok",nil) + otherButtonTitles:nil ,nil]; [errorAlert show]; [errorAlert release]; return; @@ -655,7 +654,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta - (BOOL)chatRoomStartImageDownload:(NSURL*)url userInfo:(id)userInfo { if(imageSharing == nil) { - imageSharing = [ImageSharing imageSharingDownload:url delegate:self userInfo:userInfo]; + imageSharing = [ImageSharing newImageSharingDownload:url delegate:self userInfo:userInfo]; [messageView setHidden:TRUE]; [transferView setHidden:FALSE]; return TRUE; @@ -666,7 +665,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta - (BOOL)chatRoomStartImageUpload:(UIImage*)image url:(NSURL*)url{ if(imageSharing == nil) { NSString *urlString = [[LinphoneManager instance] lpConfigStringForKey:@"sharing_server_preference"]; - imageSharing = [ImageSharing imageSharingUpload:[NSURL URLWithString:urlString] image:image delegate:self userInfo:url]; + imageSharing = [ImageSharing newImageSharingUpload:[NSURL URLWithString:urlString] image:image delegate:self userInfo:url]; [messageView setHidden:TRUE]; [transferView setHidden:FALSE]; return TRUE; @@ -687,7 +686,8 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta - (void)imageSharingAborted:(ImageSharing*)aimageSharing { [messageView setHidden:FALSE]; [transferView setHidden:TRUE]; - imageSharing = NULL; + [imageSharing release]; + imageSharing = nil; } - (void)imageSharingError:(ImageSharing*)aimageSharing error:(NSError *)error { @@ -696,26 +696,24 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta NSString *url = [aimageSharing.connection.currentRequest.URL absoluteString]; if (aimageSharing.upload) { [LinphoneLogger log:LinphoneLoggerError format:@"Cannot upload file to server [%@] because [%@]", url, [error localizedDescription]]; - UIAlertView* errorAlert = [UIAlertView alloc]; - [errorAlert initWithTitle:NSLocalizedString(@"Transfer error", nil) - message:NSLocalizedString(@"Cannot transfer file to remote contact", nil) - delegate:nil - cancelButtonTitle:NSLocalizedString(@"Ok",nil) - otherButtonTitles:nil ,nil]; + UIAlertView* errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Transfer error", nil) + message:NSLocalizedString(@"Cannot transfer file to remote contact", nil) + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Ok",nil) + otherButtonTitles:nil ,nil]; [errorAlert show]; [errorAlert release]; } else { [LinphoneLogger log:LinphoneLoggerError format:@"Cannot dowanlod file from [%@] because [%@]", url, [error localizedDescription]]; - UIAlertView* errorAlert = [UIAlertView alloc]; - [errorAlert initWithTitle:NSLocalizedString(@"Transfer error", nil) - message:NSLocalizedString(@"Cannot transfer file from remote contact", nil) - delegate:nil - cancelButtonTitle:NSLocalizedString(@"Continue", nil) - otherButtonTitles:nil, nil]; + UIAlertView* errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Transfer error", nil) + message:NSLocalizedString(@"Cannot transfer file from remote contact", nil) + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Continue", nil) + otherButtonTitles:nil, nil]; [errorAlert show]; [errorAlert release]; } - imageSharing = NULL; + imageSharing = nil; } - (void)imageSharingUploadDone:(ImageSharing*)aimageSharing url:(NSURL*)url{ @@ -725,7 +723,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [messageView setHidden:FALSE]; [transferView setHidden:TRUE]; - imageSharing = NULL; + imageSharing = nil; } - (void)imageSharingDownloadDone:(ImageSharing*)aimageSharing image:(UIImage *)image { @@ -738,13 +736,12 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta completionBlock:^(NSURL *assetURL, NSError *error){ if (error) { [LinphoneLogger log:LinphoneLoggerError format:@"Cannot save image data downloaded [%@]", [error localizedDescription]]; - - UIAlertView* errorAlert = [UIAlertView alloc]; - [errorAlert initWithTitle:NSLocalizedString(@"Transfer error", nil) - message:NSLocalizedString(@"Cannot write image to photo library", nil) - delegate:nil - cancelButtonTitle:NSLocalizedString(@"Ok",nil) - otherButtonTitles:nil ,nil]; + + UIAlertView* errorAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Transfer error", nil) + message:NSLocalizedString(@"Cannot write image to photo library", nil) + delegate:nil + cancelButtonTitle:NSLocalizedString(@"Ok",nil) + otherButtonTitles:nil ,nil]; [errorAlert show]; [errorAlert release]; return; @@ -754,7 +751,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta [chat update]; [tableController updateChatEntry:chat]; }]; - imageSharing = NULL; + imageSharing = nil; } diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index 1f89e971f..5b54ce21b 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -276,13 +276,17 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe CFStringRef label = (CFStringRef)[labelArray objectAtIndex:0]; ABMultiValueAddValueAndLabel(lMap, lDict, label, &index); } + if (!ABRecordSetValue(contact, kABPersonInstantMessageProperty, lMap, (CFErrorRef*)&error)) { [LinphoneLogger log:LinphoneLoggerLog format:@"Can't set contact with value [%@] cause [%@]", value,[error localizedDescription]]; + CFRelease(lMap); } else { if (entry == nil) { - entry = [[Entry alloc] initWithData:index]; + entry = [[[Entry alloc] initWithData:index] autorelease]; } CFRelease(lDict); + CFRelease(lMap); + /*check if message type is kept or not*/ lcMap = ABRecordCopyValue(contact, kABPersonInstantMessageProperty); lMap = ABMultiValueCreateMutableCopy(lcMap); @@ -308,12 +312,13 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe ms_free(uri); } } - CFRelease(lMap); + CFRelease(lMap); } CFRelease(lDict); return entry; } + -(void) setSipContactEntry:(Entry *)entry withValue:(NSString*)value { [self setOrCreateSipContactEntry:entry withValue:value]; } @@ -337,7 +342,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe lMap = ABMultiValueCreateMutable(kABStringPropertyType); } CFStringRef label = (CFStringRef)[labelArray objectAtIndex:0]; - if(!ABMultiValueAddValueAndLabel(lMap, [value copy], label, &identifier)) { + if(!ABMultiValueAddValueAndLabel(lMap, [[value copy] autorelease], label, &identifier)) { added = false; } @@ -354,7 +359,6 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe Entry *entry = [self setOrCreateSipContactEntry:nil withValue:value]; if (entry) { [sectionArray addObject:entry]; - [entry release]; added=true; } else { added=false; @@ -371,7 +375,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe lMap = ABMultiValueCreateMutable(kABStringPropertyType); } CFStringRef label = (CFStringRef)[labelArray objectAtIndex:0]; - if(!ABMultiValueAddValueAndLabel(lMap, [value copy], label, &identifier)) { + if(!ABMultiValueAddValueAndLabel(lMap, [[value copy] autorelease], label, &identifier)) { added = false; } diff --git a/Classes/ContactsTableViewController.m b/Classes/ContactsTableViewController.m index 8fb2b7be3..459f86e4e 100644 --- a/Classes/ContactsTableViewController.m +++ b/Classes/ContactsTableViewController.m @@ -111,12 +111,14 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf } CFRelease(lDict); } + CFRelease(lMap); } if ((add == false) && [ContactSelection getEmailFilter]) { ABMultiValueRef lMap = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonEmailProperty); if (ABMultiValueGetCount(lMap) > 0) { add = true; } + CFRelease(lMap); } if(add) { CFStringRef lFirstName = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonFirstNameProperty); diff --git a/Classes/ContactsViewController.m b/Classes/ContactsViewController.m index b188f9b0c..e52695c24 100644 --- a/Classes/ContactsViewController.m +++ b/Classes/ContactsViewController.m @@ -154,8 +154,8 @@ static UICompositeViewDescription *compositeDescription = nil; // let the toolBar be visible subViewFrame.origin.y += self.toolBar.frame.size.height; - self.tableController = [[ContactsTableViewController alloc] init]; - self.tableView = [[UITableView alloc] init]; + self.tableController = [[[ContactsTableViewController alloc] init] autorelease]; + self.tableView = [[[UITableView alloc] init] autorelease]; self.tableController.view = self.tableView; self.tableView.frame = subViewFrame; @@ -309,7 +309,7 @@ static UICompositeViewDescription *compositeDescription = nil; // Go to dialer view DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController); if(controller != nil) { - [controller call:phoneNumber displayName:(NSString*)ABRecordCopyCompositeName(person)]; + [controller call:phoneNumber displayName:[(NSString*)ABRecordCopyCompositeName(person) autorelease]]; } [phoneNumber release]; CFRelease(multiValue); diff --git a/Classes/DialerViewController.m b/Classes/DialerViewController.m index 7a3070309..4ccaacacd 100644 --- a/Classes/DialerViewController.m +++ b/Classes/DialerViewController.m @@ -162,9 +162,11 @@ static UICompositeViewDescription *compositeDescription = nil; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { // fix placeholder bar color in iOS7 UIColor *color = [UIColor grayColor]; - addressField.attributedPlaceholder = [[NSAttributedString alloc] - initWithString:NSLocalizedString(@"Enter an address", @"Enter an address") - attributes:@{NSForegroundColorAttributeName: color}]; + NSAttributedString* placeHolderString = [[NSAttributedString alloc] + initWithString:NSLocalizedString(@"Enter an address", @"Enter an address") + attributes:@{NSForegroundColorAttributeName: color}]; + addressField.attributedPlaceholder = placeHolderString; + [placeHolderString release]; } #endif diff --git a/Classes/ImageSharing.h b/Classes/ImageSharing.h index 5949cc8a6..971a8cbfe 100644 --- a/Classes/ImageSharing.h +++ b/Classes/ImageSharing.h @@ -38,8 +38,8 @@ int statusCode; } -+ (id)imageSharingUpload:(NSURL*)url image:(UIImage*)image delegate:(id)delegate userInfo:(id)userInfo; -+ (id)imageSharingDownload:(NSURL*)url delegate:(id)delegate userInfo:(id)userInfo; ++ (id)newImageSharingUpload:(NSURL*)url image:(UIImage*)image delegate:(id)delegate userInfo:(id)userInfo; ++ (id)newImageSharingDownload:(NSURL*)url delegate:(id)delegate userInfo:(id)userInfo; - (void)cancel; diff --git a/Classes/ImageSharing.m b/Classes/ImageSharing.m index 9833ab8be..6ab27490e 100644 --- a/Classes/ImageSharing.m +++ b/Classes/ImageSharing.m @@ -30,7 +30,7 @@ #pragma mark - Lifecycle Functions -+ (id)imageSharingUpload:(NSURL*)url image:(UIImage*)image delegate:(id)delegate userInfo:(id)auserInfo{ ++ (id)newImageSharingUpload:(NSURL*)url image:(UIImage*)image delegate:(id)delegate userInfo:(id)auserInfo{ ImageSharing *imgs = [[ImageSharing alloc] init]; if(imgs != nil) { imgs.userInfo = auserInfo; @@ -45,7 +45,7 @@ return imgs; } -+ (id)imageSharingDownload:(NSURL*)url delegate:(id)delegate userInfo:(id)auserInfo{ ++ (id)newImageSharingDownload:(NSURL*)url delegate:(id)delegate userInfo:(id)auserInfo{ ImageSharing *imgs = [[ImageSharing alloc] init]; if(imgs != nil) { imgs.userInfo = auserInfo; @@ -173,6 +173,7 @@ if(delegate) { [delegate imageSharingUploadDone:self url:[NSURL URLWithString:imageRemoteUrl]]; } + [imageRemoteUrl release]; } else { UIImage* image = [UIImage imageWithData:data]; [LinphoneLogger log:LinphoneLoggerLog format:@"File downloaded"]; diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 6a62c4844..224fa59b0 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -382,6 +382,7 @@ [_waitingIndicator addSubview:progress]; } [progress startAnimating]; + [progress release]; [_waitingIndicator show]; } diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index 194665c39..0eef88242 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -49,7 +49,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); - (void)setString:(const char*)value forKey:(NSString*)key { id obj=Nil; if (value) obj=[[NSString alloc] initWithCString:value encoding:[NSString defaultCStringEncoding] ]; - [self setObject: obj forKey:key]; + [self setObject:obj forKey:key]; + [obj release]; } - (NSString*)stringForKey:(NSString*) key { diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index a0c604df9..e15d3c7db 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -332,7 +332,6 @@ struct codec_name_pref_table codec_pref_table[]={ } } - [filemgr release]; } - (void)closeDatabase { diff --git a/Classes/LinphoneUI/UICallCell.m b/Classes/LinphoneUI/UICallCell.m index 2c158537e..61ac13dbf 100644 --- a/Classes/LinphoneUI/UICallCell.m +++ b/Classes/LinphoneUI/UICallCell.m @@ -147,7 +147,7 @@ options:nil]; if ([arrayOfViews count] >= 1) { - [self addSubview:[[arrayOfViews objectAtIndex:0] retain]]; + [self.contentView addSubview:[arrayOfViews objectAtIndex:0]]; } // Set selected+over background: IB lack ! [pauseButton setImage:[UIImage imageNamed:@"call_state_pause_over.png"] @@ -513,7 +513,7 @@ if(parentTable != nil) { NSIndexPath *index= [parentTable indexPathForCell:self]; if(index != nil) { - [parentTable reloadRowsAtIndexPaths:[[NSArray alloc] initWithObjects:index, nil] withRowAnimation:false]; + [parentTable reloadRowsAtIndexPaths:[[[NSArray alloc] initWithObjects:index, nil] autorelease] withRowAnimation:false]; } } } diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 785be72e4..f1604df36 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -42,7 +42,8 @@ options:nil]; if ([arrayOfViews count] >= 1) { - [self addSubview:[[arrayOfViews objectAtIndex:0] retain]]; + + [self.contentView addSubview:[arrayOfViews objectAtIndex:0]]; } [chatContentLabel setAdjustsFontSizeToFitWidth:TRUE]; // Auto shrink: IB lack! } diff --git a/Classes/LinphoneUI/UIChatRoomCell.m b/Classes/LinphoneUI/UIChatRoomCell.m index 2485f0f21..645fc9d59 100644 --- a/Classes/LinphoneUI/UIChatRoomCell.m +++ b/Classes/LinphoneUI/UIChatRoomCell.m @@ -191,6 +191,7 @@ static UIFont *CELL_FONT = nil; initWithString:NSLocalizedString(@"Resend", @"Resend") attributes:@{NSForegroundColorAttributeName: [UIColor redColor]}]; [dateLabel setAttributedText:resend_text]; + [resend_text release]; } else { statusImage.hidden = TRUE; } diff --git a/Classes/LinphoneUI/UIContactCell.m b/Classes/LinphoneUI/UIContactCell.m index 59a8c7ebb..8bfeb9eea 100644 --- a/Classes/LinphoneUI/UIContactCell.m +++ b/Classes/LinphoneUI/UIContactCell.m @@ -38,7 +38,7 @@ options:nil]; if ([arrayOfViews count] >= 1) { - [self addSubview:[[arrayOfViews objectAtIndex:0] retain]]; + [self.contentView addSubview:[arrayOfViews objectAtIndex:0] ]; } } return self; diff --git a/Classes/LinphoneUI/UIEditableTableViewCell.m b/Classes/LinphoneUI/UIEditableTableViewCell.m index 46893b7a0..0d450c642 100644 --- a/Classes/LinphoneUI/UIEditableTableViewCell.m +++ b/Classes/LinphoneUI/UIEditableTableViewCell.m @@ -58,7 +58,7 @@ } - (void)dealloc { - [self.detailTextField release]; + self.detailTextField = nil; [super dealloc]; } diff --git a/Classes/LinphoneUI/UIHistoryCell.m b/Classes/LinphoneUI/UIHistoryCell.m index 752fe178a..48422abe2 100644 --- a/Classes/LinphoneUI/UIHistoryCell.m +++ b/Classes/LinphoneUI/UIHistoryCell.m @@ -39,7 +39,7 @@ options:nil]; if ([arrayOfViews count] >= 1) { - [self addSubview:[[arrayOfViews objectAtIndex:0] retain]]; + [self.contentView addSubview:[arrayOfViews objectAtIndex:0]]; } self->callLog = NULL; diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m index 0253c956f..831c430a8 100644 --- a/Classes/SettingsViewController.m +++ b/Classes/SettingsViewController.m @@ -365,6 +365,7 @@ labelTitleView.text = viewController.title; [labelTitleView sizeToFit]; viewController.navigationItem.titleView = labelTitleView; + [labelTitleView release]; [super pushViewController:viewController animated:animated]; if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) { [self.topViewController viewDidAppear:animated]; @@ -703,7 +704,7 @@ static UICompositeViewDescription *compositeDescription = nil; NSString *key = [specifier.specifierDict objectForKey:kIASKKey]; #ifdef DEBUG if([key isEqual:@"release_button"]) { - [[UIApplication sharedApplication].keyWindow.rootViewController release]; + [UIApplication sharedApplication].keyWindow.rootViewController = nil; [[UIApplication sharedApplication].keyWindow setRootViewController:nil]; [[LinphoneManager instance] destroyLibLinphone]; [LinphoneManager instanceRelease]; diff --git a/Classes/Utils/DTFoundation/DTActionSheet.m b/Classes/Utils/DTFoundation/DTActionSheet.m index 070d974de..f3a474c75 100755 --- a/Classes/Utils/DTFoundation/DTActionSheet.m +++ b/Classes/Utils/DTFoundation/DTActionSheet.m @@ -60,7 +60,7 @@ if (block) { NSNumber *key = [NSNumber numberWithInt:retIndex]; - [_actionsPerIndex setObject:[block copy] forKey:key]; + [_actionsPerIndex setObject:[[block copy] autorelease] forKey:key]; } return retIndex; diff --git a/Classes/Utils/GrowingTextView/HPGrowingTextView.m b/Classes/Utils/GrowingTextView/HPGrowingTextView.m index f8c143f9c..6f14c6833 100755 --- a/Classes/Utils/GrowingTextView/HPGrowingTextView.m +++ b/Classes/Utils/GrowingTextView/HPGrowingTextView.m @@ -358,7 +358,7 @@ if ([textToMeasure.string hasSuffix:@"\n"]) { - [textToMeasure appendAttributedString:[[NSAttributedString alloc] initWithString:@"-" attributes:@{NSFontAttributeName: internalTextView.font}]]; + [textToMeasure appendAttributedString:[[[NSAttributedString alloc] initWithString:@"-" attributes:@{NSFontAttributeName: internalTextView.font}]autorelease]]; } // NSAttributedString class method: boundingRectWithSize:options:context is @@ -366,6 +366,7 @@ CGRect size = [textToMeasure boundingRectWithSize:CGSizeMake(CGRectGetWidth(frame), MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin context:nil]; + [textToMeasure release]; return CGRectGetHeight(size) + fudgeFactor.height; }