From a21f1febe29fbc2c7e00ff97913c04c247bfb95b Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 19 May 2019 00:51:56 -0700 Subject: libs/ray: fix off by one error in prepared objects Missed the sentinel, oops --- src/libs/ray/ray_render.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libs/ray/ray_render.c b/src/libs/ray/ray_render.c index 32c45dc..e551d8c 100644 --- a/src/libs/ray/ray_render.c +++ b/src/libs/ray/ray_render.c @@ -228,7 +228,7 @@ ray_render_t * ray_render_new(const ray_scene_t *scene, const ray_camera_t *came for (i = 0, object = scene->objects; object->type; object++) i++; - render = malloc(sizeof(ray_render_t) + i * sizeof(ray_render_object_t)); + render = malloc(sizeof(ray_render_t) + (i + 1) * sizeof(ray_render_object_t)); if (!render) return NULL; @@ -241,6 +241,8 @@ ray_render_t * ray_render_new(const ray_scene_t *scene, const ray_camera_t *came for (i = 0, object = scene->objects; object->type; object++) render->objects[i++] = ray_render_object_prepare(object, camera); + render->objects[i].type = RAY_OBJECT_TYPE_SENTINEL; + return render; } -- cgit v1.2.3