diff --git a/packages/react-native/React/Views/RCTBorderDrawing.m b/packages/react-native/React/Views/RCTBorderDrawing.m index 86c15d1e4c7..67bf10cba93 100644 --- a/packages/react-native/React/Views/RCTBorderDrawing.m +++ b/packages/react-native/React/Views/RCTBorderDrawing.m @@ -232,6 +232,8 @@ static UIImage *RCTGetSolidBorderImage( UIGraphicsImageRenderer *const imageRenderer = RCTMakeUIGraphicsImageRenderer(size, backgroundColor, hasCornerRadii, drawToEdge); + + CGColorRetain(backgroundColor); UIImage *image = [imageRenderer imageWithActions:^(UIGraphicsImageRendererContext *_Nonnull rendererContext) { const CGContextRef context = rendererContext.CGContext; const CGRect rect = {.size = size}; @@ -242,6 +244,7 @@ static UIImage *RCTGetSolidBorderImage( CGContextAddPath(context, path); CGContextFillPath(context); } + CGColorRelease(backgroundColor); CGContextAddPath(context, path); CGPathRelease(path);