comparison 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
comparison
equal deleted inserted replaced
1592:31effaadf877 1593:24508cb54f87
614 uint32_t len = strlen(curstr); 614 uint32_t len = strlen(curstr);
615 if (len > 11) { 615 if (len > 11) {
616 len = 11; 616 len = 11;
617 } 617 }
618 memcpy(buffer, curstr, len); 618 memcpy(buffer, curstr, len);
619 memset(buffer+len, 0, sizeof(buffer)-len);
619 nk_edit_string(context, NK_EDIT_SIMPLE, buffer, &len, sizeof(buffer)-1, nk_filter_decimal); 620 nk_edit_string(context, NK_EDIT_SIMPLE, buffer, &len, sizeof(buffer)-1, nk_filter_decimal);
620 buffer[len] = 0; 621 buffer[len] = 0;
621 if (strcmp(buffer, curstr)) { 622 if (strcmp(buffer, curstr)) {
622 config_dirty = 1; 623 config_dirty = 1;
623 config = tern_insert_path(config, path, (tern_val){.ptrval = strdup(buffer)}, TVAL_PTR); 624 config = tern_insert_path(config, path, (tern_val){.ptrval = strdup(buffer)}, TVAL_PTR);
1066 uint8_t *font = default_font(&font_size); 1067 uint8_t *font = default_font(&font_size);
1067 if (!font) { 1068 if (!font) {
1068 fatal_error("Failed to find default font path\n"); 1069 fatal_error("Failed to find default font path\n");
1069 } 1070 }
1070 def_font = nk_font_atlas_add_from_memory(atlas, font, font_size, render_height() / 16, NULL); 1071 def_font = nk_font_atlas_add_from_memory(atlas, font, font_size, render_height() / 16, NULL);
1072 free(font);
1071 nk_sdl_font_stash_end(); 1073 nk_sdl_font_stash_end();
1072 nk_style_set_font(context, &def_font->handle); 1074 nk_style_set_font(context, &def_font->handle);
1073 if (controller_360_buf) { 1075 if (controller_360_buf) {
1074 GLuint tex; 1076 GLuint tex;
1075 glGenTextures(1, &tex); 1077 glGenTextures(1, &tex);