Fix model deallocation.

This commit is contained in:
Marcel Plch 2024-10-23 17:18:28 +02:00
parent 9702382a16
commit 3b6b133001
Signed by: dormouse
GPG key ID: 2CA77596BC4BDFFE

View file

@ -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;