From 3b6b133001f56885d9dc226be13b6d7dc1614dc2 Mon Sep 17 00:00:00 2001 From: Marcel Plch Date: Wed, 23 Oct 2024 17:18:28 +0200 Subject: [PATCH] Fix model deallocation. --- src/model.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/model.c b/src/model.c index a5d1ff2..73dd8b6 100644 --- a/src/model.c +++ b/src/model.c @@ -16,6 +16,9 @@ int model_free(Model *self) { free(self->object); free(self->colors); + for (int i = 0; i < self->transformation_count; i++) { + tensor_free(self->transformations[i]); + } free(self->transformations); free(self); return 0; @@ -102,7 +105,8 @@ model_applyTransformations(Model *self) { retval = malloc(self->bufsize * 4 * sizeof(GLfloat)); for (int k = 0; k < self->bufsize; k++) { for (int j = 0; j < 4; j++) { - retval[k*4+j] = temp_buffer[(i+1)%2]->data[j*temp_buffer[(i+1)%2]->width+k]; + retval[k*4+j] = temp_buffer[(i+1)%2] + ->data[j*temp_buffer[(i+1)%2]->width+k]; } } return retval;