Skip to content

Commit 3d84f6c

Browse files
committed
really fixed memory issue
1 parent 1cc9fa9 commit 3d84f6c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/nuklear_font.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ nk_font_baker_memory(nk_size *temp, int *glyph_count,
138138
} while ((i = i->n) != iter);
139139
}
140140
*temp = (nk_size)*glyph_count * sizeof(struct stbrp_rect);
141-
*temp += (nk_size)*glyph_count * sizeof(stbtt_pack_range);
141+
*temp += (nk_size)total_range_count * sizeof(stbtt_pack_range);
142142
*temp += (nk_size)*glyph_count * sizeof(stbtt_packedchar);
143143
*temp += (nk_size)count * sizeof(struct nk_font_bake_data);
144144
*temp += sizeof(struct nk_font_baker);
@@ -1179,6 +1179,7 @@ nk_font_atlas_bake(struct nk_font_atlas *atlas, int *width, int *height,
11791179
tmp = atlas->temporary.alloc(atlas->temporary.userdata,0, tmp_size);
11801180
NK_ASSERT(tmp);
11811181
if (!tmp) goto failed;
1182+
memset(tmp,0,tmp_size);
11821183

11831184
/* allocate glyph memory for all fonts */
11841185
baker = nk_font_baker(tmp, atlas->glyph_count, atlas->font_num, &atlas->temporary);

0 commit comments

Comments
 (0)