[Examples/Intro] Fix NULL pointer deref due to huuge malloc (#120)
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled

This commit is contained in:
FintasticMan 2024-12-28 17:39:38 +00:00 committed by GitHub
parent 37af99b221
commit 5831a8ac7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -79,10 +79,7 @@ int main(void) {
Clay_Raylib_Initialize(1024, 768, "Introducing Clay Demo", FLAG_WINDOW_RESIZABLE | FLAG_WINDOW_HIGHDPI | FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT); // Extra parameters to this function are new since the video was published
uint64_t clayRequiredMemory = Clay_MinMemorySize();
Clay_Arena clayMemory = (Clay_Arena) {
.memory = malloc((size_t)1024 * 1024 * 1024 * 1024),
.capacity = clayRequiredMemory
};
Clay_Arena clayMemory = Clay_CreateArenaWithCapacityAndMemory(clayRequiredMemory, malloc(clayRequiredMemory));
Clay_Initialize(clayMemory, (Clay_Dimensions) {
.width = GetScreenWidth(),
.height = GetScreenHeight()