diff --git a/ios/Classes/Helpers/UIImageExtension.m b/ios/Classes/Helpers/UIImageExtension.m index e9b58ae..416a88a 100644 --- a/ios/Classes/Helpers/UIImageExtension.m +++ b/ios/Classes/Helpers/UIImageExtension.m @@ -42,6 +42,7 @@ + (nullable float*)normalize:(UIImage*)image withMean:(NSArray*)mean normalizedBuffer[w * h * 2 + i] = (rawBytes[i * 4 + 2] / 255.0 - mean[2].floatValue) / std[2].floatValue; } + free(rawBytes); return normalizedBuffer; } diff --git a/ios/Classes/PyTorchMobilePlugin.mm b/ios/Classes/PyTorchMobilePlugin.mm index b9a714f..df36630 100644 --- a/ios/Classes/PyTorchMobilePlugin.mm +++ b/ios/Classes/PyTorchMobilePlugin.mm @@ -101,6 +101,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { } catch (const std::exception& e) { NSLog(@"PyTorchMobile: %s", e.what()); } + + free(input); break; }