diff --git a/ios/Text/RNSVGGlyphContext.m b/ios/Text/RNSVGGlyphContext.m index c385e56a..1e3b61ca 100644 --- a/ios/Text/RNSVGGlyphContext.m +++ b/ios/Text/RNSVGGlyphContext.m @@ -191,7 +191,10 @@ CTFontDescriptorRef ctfd = (__bridge CTFontDescriptorRef)(uifd); CTFontDescriptorRef newfd = CTFontDescriptorCreateCopyWithVariation(ctfd, wght_id, (CGFloat)weight); CTFontRef newfont = CTFontCreateCopyWithAttributes(ref, size, nil, newfd); - return newfont; + + CFRelease(newfd); + + return (CTFontRef)CFAutorelease(newfont); } - (void)pushIndices diff --git a/ios/Text/RNSVGTSpan.m b/ios/Text/RNSVGTSpan.m index 16b94c40..0888b3f9 100644 --- a/ios/Text/RNSVGTSpan.m +++ b/ios/Text/RNSVGTSpan.m @@ -140,6 +140,9 @@ static CGFloat RNSVGTSpan_radToDeg = 180 / (CGFloat)M_PI; TopAlignedLabel *label; - (void)drawWrappedText:(CGContextRef)context gc:(RNSVGGlyphContext *)gc rect:(CGRect)rect { [self pushGlyphContext]; + if (fontRef != nil) { + CFRelease(fontRef); + } fontRef = [self getFontFromContext]; RNSVGFontData* fontdata = [gc getFont]; CFStringRef string = (__bridge CFStringRef)self.content;