image: Use stbi_image_free() instead of freeing buffer ourselves

This commit is contained in:
mintsuki 2023-03-05 08:47:38 +01:00
parent baf5f6c2ce
commit 7b9600c893
3 changed files with 4 additions and 3 deletions

View File

@ -804,6 +804,9 @@ no_load_font:;
pmm_free(font, FONT_MAX);
image_close(background);
background = NULL;
if (terms_i == 0) {
return false;
}

View File

@ -48,7 +48,6 @@ struct image *image_open(struct file_handle *file) {
pptr[i] = (pptr[i] & 0x0000ff00) | ((pptr[i] & 0x00ff0000) >> 16) | ((pptr[i] & 0x000000ff) << 16);
}
image->allocated_size = x * y * 4;
image->x_size = x;
image->y_size = y;
image->pitch = x * 4;
@ -60,6 +59,6 @@ struct image *image_open(struct file_handle *file) {
}
void image_close(struct image *image) {
pmm_free(image->img, image->allocated_size);
stbi_image_free(image->img);
pmm_free(image, sizeof(struct image));
}

View File

@ -5,7 +5,6 @@
#include <fs/file.h>
struct image {
size_t allocated_size;
size_t x_size;
size_t y_size;
int type;