From e54c7e9675b9e90ede791318a6ebe0eb8e78741b Mon Sep 17 00:00:00 2001 From: romanprocopie Date: Wed, 20 Nov 2019 17:21:41 +0000 Subject: [PATCH] Leaked images (#41) * Leaked images * Moved the resource release code up a bit --- OSXvnc-server/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OSXvnc-server/main.c b/OSXvnc-server/main.c index 8432917..374dd88 100644 --- a/OSXvnc-server/main.c +++ b/OSXvnc-server/main.c @@ -654,8 +654,10 @@ void rfbGetFramebufferUpdateInRect(int x, int y, int w, int h) { return; } CGContextDrawImage(context, CGRectMake(0, 0, w, h), image); + CGImageRelease(image); imageRef = CGBitmapContextCreateImage(context); CGContextRelease(context); + } else { imageRef = CGDisplayCreateImageForRect(displayID, rect); } @@ -731,8 +733,10 @@ static bool rfbScreenInit(void) { return nil; } CGContextDrawImage(context, CGRectMake(0, 0, width, height), image); + CGImageRelease(image); imageRef = CGBitmapContextCreateImage(context); CGContextRelease(context); + } else { imageRef = CGDisplayCreateImage(displayID); }