summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/darwin/src/MGLMapSnapshotter.mm8
1 files changed, 6 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm
index dea93eba34..346666cf80 100644
--- a/platform/darwin/src/MGLMapSnapshotter.mm
+++ b/platform/darwin/src/MGLMapSnapshotter.mm
@@ -321,14 +321,18 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
CIContext *ctx = [CIContext contextWithOptions:nil];
CGImageRef cgimg = [ctx createCGImage:blurredImage fromRect:[backgroundImage extent]];
+ MGLImage *image;
#if TARGET_OS_IPHONE
- return [UIImage imageWithCGImage:cgimg];
+ image = [UIImage imageWithCGImage:cgimg];
#else
- return [[NSImage alloc] initWithCGImage:cgimg size:[backgroundImage extent].size];
+ image = [[NSImage alloc] initWithCGImage:cgimg size:[backgroundImage extent].size];
#endif
+
+ CGImageRelease(cgimg);
+ return image;
}
- (void)cancel