Mercurial > repos > blastem
diff nuklear_ui/blastem_nuklear.c @ 1593:24508cb54f87
Fix a number of other memory errors (mostly leaks again) identified by valgrind
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 28 Jun 2018 09:27:05 -0700 |
parents | 7121daaa48c2 |
children | 437e80a700aa |
line wrap: on
line diff
--- a/nuklear_ui/blastem_nuklear.c Fri Jun 22 23:10:27 2018 -0700 +++ b/nuklear_ui/blastem_nuklear.c Thu Jun 28 09:27:05 2018 -0700 @@ -616,6 +616,7 @@ len = 11; } memcpy(buffer, curstr, len); + memset(buffer+len, 0, sizeof(buffer)-len); nk_edit_string(context, NK_EDIT_SIMPLE, buffer, &len, sizeof(buffer)-1, nk_filter_decimal); buffer[len] = 0; if (strcmp(buffer, curstr)) { @@ -1068,6 +1069,7 @@ fatal_error("Failed to find default font path\n"); } def_font = nk_font_atlas_add_from_memory(atlas, font, font_size, render_height() / 16, NULL); + free(font); nk_sdl_font_stash_end(); nk_style_set_font(context, &def_font->handle); if (controller_360_buf) {