From 3ccc2f538d953de6934ed3734ab0f922c2c65418 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Sun, 1 Nov 2020 13:39:16 +0100 Subject: [PATCH] Fix memory leak in unlikely failure condition Found with the Clang Static Analyzer. --- glfw/cocoa_window.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glfw/cocoa_window.m b/glfw/cocoa_window.m index c8e58fe26..e7313fb87 100644 --- a/glfw/cocoa_window.m +++ b/glfw/cocoa_window.m @@ -1994,8 +1994,10 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor, bitmapFormat:NSBitmapFormatAlphaNonpremultiplied bytesPerRow:src->width * 4 bitsPerPixel:32]; - if (rep == nil) + if (rep == nil) { + [native release]; return false; + } memcpy([rep bitmapData], src->pixels, src->width * src->height * 4); [native addRepresentation:rep];