IosSslSocket: add autoreleasepool to free temporary arrays in the SSL callbacks.
Change on 2018/11/26 by antoniocortes
@@ -336,6 +336,7 @@ static NSDictionary *protocolMapping;
@end
static OSStatus SslReadCallback(SSLConnectionRef connection, void *data, size_t *dataLength) {
+ @autoreleasepool {
ComGoogleJ2objcNetSslIosSslSocket *socket = (ComGoogleJ2objcNetSslIosSslSocket *) connection;
IOSByteArray *array = [IOSByteArray arrayWithLength:*dataLength];
jint processed;
@@ -358,10 +359,12 @@ static OSStatus SslReadCallback(SSLConnectionRef connection, void *data, size_t
*dataLength = processed;
return status;
}
+}
static OSStatus SslWriteCallback(SSLConnectionRef connection,
const void *data,
size_t *dataLength) {
+ @autoreleasepool {
ComGoogleJ2objcNetSslIosSslSocket *socket = (ComGoogleJ2objcNetSslIosSslSocket *) connection;
IOSByteArray *array = [IOSByteArray arrayWithBytes:(const jbyte *)data count:*dataLength];
@try {
@@ -373,6 +376,7 @@ static OSStatus SslWriteCallback(SSLConnectionRef connection,
}
return errSecSuccess;
}
+}
static void checkStatus(OSStatus status) {
if (status != errSecSuccess) {
