C++ 使用TTF_RenderText_时内存泄漏

C++ 使用TTF_RenderText_时内存泄漏,c++,memory-leaks,sdl-2,sdl-ttf,C++,Memory Leaks,Sdl 2,Sdl Ttf,我正在使用SDL_TTF绘制文本,内存泄漏已缩小到上面的函数,特别是这一行: text\u surface=TTF\u RenderText\u混合(temp\u字体,text.get\u字符串().c\u str(),text\u颜色) 在opengl中使用曲面后,在再次运行上述函数之前,我正在调用SDL_FreeSurface,但是它仍然在泄漏 class Renderer{ public: void text_to_sdl_surface(Text text, Colour col

我正在使用SDL_TTF绘制文本,内存泄漏已缩小到上面的函数,特别是这一行:
text\u surface=TTF\u RenderText\u混合(temp\u字体,text.get\u字符串().c\u str(),text\u颜色)

在opengl中使用曲面后,在再次运行上述函数之前,我正在调用
SDL_FreeSurface
,但是它仍然在泄漏

class Renderer{
public:
    void text_to_sdl_surface(Text text, Colour colour);
    Font get_font(std::string font_name, int font_size);
private:
    SDL_Surface * text_surface;
};

void Renderer::text_to_sdl_surface(Text text, Colour colour) {
    glColor4f(1,1,1,1);
    SDL_Color text_colour;
    text_colour.r = Uint8(colour.get_colour_as_int()[0]);
    text_colour.g = Uint8(colour.get_colour_as_int()[1]);
    text_colour.b = Uint8(colour.get_colour_as_int()[2]);
    TTF_Font * temp_font = get_font(text.get_fontname(), text.get_fontsize()).get_font();
    text_surface = TTF_RenderText_Blended(temp_font, text.get_string().c_str(), text_colour);

}