1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-07 09:31:31 +01:00

feat: add autoreleasepool to avoid memory leaks

This commit is contained in:
Andreas Coroiu 2024-07-23 11:33:50 +02:00
parent b3c29aab14
commit ae87718163
No known key found for this signature in database
GPG Key ID: E70B5FFC81DFEC1A

View File

@ -46,15 +46,17 @@ void free_objc_string(struct ObjCString *value) {
}
struct ObjCString run_command(char* input_json) {
@try {
NSString *inputString = c_string_to_nsstring(input_json);
@autoreleasepool {
@try {
NSString *inputString = c_string_to_nsstring(input_json);
// NSString *outputString = [NSString stringWithFormat:@"{\"added\": %@}", e];
NSString *outputString = @"{\"added\": 0}";
return nsstring_to_obj_c_string(outputString);
} @catch (NSException *e) {
NSString *outputString = [NSString stringWithFormat:@"Error occurred while running Objective-C command: %@", e];
return nsstring_to_obj_c_string(outputString);
// NSString *outputString = [NSString stringWithFormat:@"{\"added\": %@}", e];
NSString *outputString = @"{\"added\": 0}";
return nsstring_to_obj_c_string(outputString);
} @catch (NSException *e) {
NSString *outputString = [NSString stringWithFormat:@"Error occurred while running Objective-C command: %@", e];
return nsstring_to_obj_c_string(outputString);
}
}
}