diff options
| author | iamcheeseman <[email protected]> | 2026-05-11 21:25:53 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-05-11 21:25:53 -0400 |
| commit | c1dd3ce9850fb2906aa5937b4374d1c0fc74ccf7 (patch) | |
| tree | 280796b30fe69df1f5ca83a016e3845c3c2f51b1 /dc/dc.c | |
| parent | 06cdc35c5a993440a0b61f6e29f6ccbf4ff608ff (diff) | |
fix a double free
Diffstat (limited to 'dc/dc.c')
| -rw-r--r-- | dc/dc.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -13,7 +13,7 @@ #define TILE_SIZE 16 struct ty_image img; -struct ty_font font; +struct ty_font font = {}; double last_frame = 0; @@ -182,8 +182,14 @@ int main(void) ty_free_image(img); ty_free_image(font_img); - for (int i = 0; i < CHAR_MAX; i++) - ty_free_image(font.glyphs[i]); + for (int i = 0; i < CHAR_MAX; i++) { + if (i >= 'a' && i <= 'z') + continue; + struct ty_image glyph = font.glyphs[i]; + if (glyph.width * glyph.height == 0) + continue; + ty_free_image(glyph); + } ty_deinit(); return 0; |
