0
Я получаю случайные сбои malloc в stringByReplacingOccurrencesOfString. Я заметил, что он падает на более длинные строки, но я не могу найти почему. В чем может быть проблема?Случайные сбои malloc в stringByReplacingOccurrencesOfString
Ошибка:
CashTrader(53448,0xb0103000) malloc: *** error for object 0x5c5eca0: incorrect checksum for freed object - object was probably modified after being freed.
Входной encryptedparams
raStwjnw9uiOEHzF00UazOUp879zUuLwJ6J300BH2DMH29Pww/4mOR3oHXv4F/CL
Пример кода:
-(NSURL *)createReqUrl:(NSString *)hostString secure:(BOOL)usessl urlRoot:(NSString*)urlRoot encryptedParam:(NSString *)encryptedparams{
NSString *encryptString;
encryptString = nil;
encryptString = [encryptedparams stringByReplacingOccurrencesOfString:@"+" withString:@"%%2b"];
encryptString = [encryptString stringByReplacingOccurrencesOfString:@"/" withString:@"%%2f"];
encryptString = [encryptString stringByReplacingOccurrencesOfString:@"=" withString:@"%%3d"];
encryptString = [encryptString stringByReplacingOccurrencesOfString:@"@" withString:@"%%40"];
NSString *answer = [[NSString alloc] initWithString:urlRoot];
answer = [[answer stringByAppendingString:encryptString] stringByReplacingOccurrencesOfString:@"%%" withString:@"%"];
NSString *scheme = nil;
if (usessl)
scheme = @"https://";
else
scheme = @"http://";
return [[NSURL alloc] initWithString:[[scheme stringByAppendingString:hostString] stringByAppendingString:answer]];;
}