mem leak: both textdir() and uppercase() allocate
This commit is contained in:
parent
9f23f1d24d
commit
f4435ebd75
1 changed files with 10 additions and 16 deletions
|
|
@ -6945,27 +6945,21 @@ static void setup(int argc, char * argv[])
|
||||||
|
|
||||||
|
|
||||||
/* Render a button label using the appropriate string/font: */
|
/* Render a button label using the appropriate string/font: */
|
||||||
|
|
||||||
static SDL_Surface * do_render_button_label(const char * const label)
|
static SDL_Surface * do_render_button_label(const char * const label)
|
||||||
{
|
{
|
||||||
char * str;
|
|
||||||
SDL_Surface * tmp_surf, * surf;
|
SDL_Surface * tmp_surf, * surf;
|
||||||
SDL_Color black = {0, 0, 0, 0};
|
SDL_Color black = {0, 0, 0, 0};
|
||||||
|
TTF_Font * myfont = small_font;
|
||||||
|
|
||||||
if (need_own_font && locale_font != NULL &&
|
if (need_own_font && strcmp(gettext(label), label))
|
||||||
strcmp(gettext(label), label) != 0)
|
myfont = locale_font;
|
||||||
{
|
char *td_str = textdir(gettext(label));
|
||||||
tmp_surf = TTF_RenderUTF8_Blended(locale_font, textdir(gettext(label)), black);
|
char *upstr = uppercase(td_str);
|
||||||
surf = thumbnail(tmp_surf, min(48, tmp_surf->w), tmp_surf->h, 0);
|
free(td_str);
|
||||||
}
|
tmp_surf = TTF_RenderUTF8_Blended(myfont, upstr, black);
|
||||||
else
|
free(upstr);
|
||||||
{
|
surf = thumbnail(tmp_surf, min(48, tmp_surf->w), tmp_surf->h, 0);
|
||||||
str = uppercase(textdir(gettext(label)));
|
SDL_FreeSurface(tmp_surf);
|
||||||
tmp_surf = TTF_RenderUTF8_Blended(small_font, str, black);
|
|
||||||
surf = thumbnail(tmp_surf, min(48, tmp_surf->w), tmp_surf->h, 0);
|
|
||||||
free(str);
|
|
||||||
SDL_FreeSurface(tmp_surf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return surf;
|
return surf;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue