Fix memory leak in unlikely failure condition

Found with the Clang Static Analyzer.
This commit is contained in:
Luflosi 2020-11-01 13:39:16 +01:00
parent 17375f0be2
commit 3ccc2f538d
No known key found for this signature in database
GPG Key ID: 4E41E29EDCC345D0

View File

@ -1994,8 +1994,10 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
bitmapFormat:NSBitmapFormatAlphaNonpremultiplied bitmapFormat:NSBitmapFormatAlphaNonpremultiplied
bytesPerRow:src->width * 4 bytesPerRow:src->width * 4
bitsPerPixel:32]; bitsPerPixel:32];
if (rep == nil) if (rep == nil) {
[native release];
return false; return false;
}
memcpy([rep bitmapData], src->pixels, src->width * src->height * 4); memcpy([rep bitmapData], src->pixels, src->width * src->height * 4);
[native addRepresentation:rep]; [native addRepresentation:rep];