summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoronelin <oscar@nelin.dk>2025-03-21 11:31:11 +0000
committeronelin <oscar@nelin.dk>2025-03-21 11:31:31 +0000
commit7e887d8c7a2b79be986e17f455cade65d30af64a (patch)
treec0021bea0826e76759972a617e94098acdbb72ea
parentdfce15c0d275b05c56f6fa62224dc938b71ac378 (diff)
Initialize memory as zero
-rw-r--r--src/core/src/loop.c7
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 */