diff options
| author | onelin <oscar@nelin.dk> | 2025-03-21 11:31:11 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2025-03-21 11:31:31 +0000 |
| commit | 7e887d8c7a2b79be986e17f455cade65d30af64a (patch) | |
| tree | c0021bea0826e76759972a617e94098acdbb72ea /src/core | |
| parent | dfce15c0d275b05c56f6fa62224dc938b71ac378 (diff) | |
Initialize memory as zero
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/src/loop.c | 7 |
1 files 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 */ |
