From 7e887d8c7a2b79be986e17f455cade65d30af64a Mon Sep 17 00:00:00 2001 From: onelin Date: Fri, 21 Mar 2025 12:31:11 +0100 Subject: Initialize memory as zero --- src/core/src/loop.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/src/loop.c b/src/core/src/loop.c index 076dc05..0062173 100644 --- a/src/core/src/loop.c +++ b/src/core/src/loop.c @@ -115,11 +115,11 @@ Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight #endif v2_i32 windowsize = (v2_i32){.x = windowWidth, .y = windowHeight}; - Platform* p = (Platform*)malloc(sizeof(Platform)); - Window* w = (Window*)malloc(sizeof(Window)); + Platform* p = (Platform*)calloc(1, sizeof(Platform)); + Window* w = (Window*)calloc(1, sizeof(Window)); /* initialize resources */ - Resources* resources = malloc(sizeof(Resources)); + Resources* resources = calloc(1, sizeof(Resources)); // TODO: Initialize them :) w = init_window_glfw(windowtitle, (ivec2){windowsize.x, windowsize.y}, flags); @@ -413,6 +413,7 @@ void engine_stop(Platform* p) { //} destroy_window(p->window); + free(p->resources); } /* Set the maximum framerate */ -- cgit v1.3