Calling this function twice in a row will crash the program. I think the issue is that the implementation is creating a CGDisplayMode by taking a pointer to the display mode returned by CGDisplayCopyAllDisplayModes, but the array is freed when the function returns. I believe there is a double-free happening here. Adding a CGDisplayModeRetain call might solve the issue. I'm confused by the macros that this library uses, so I'm not sure that this is the correct solution however.