From fc8e95f3642079b11516e70069315a39bed93d70 Mon Sep 17 00:00:00 2001 From: oetiker Date: Mon, 26 Sep 2005 20:33:45 +0000 Subject: [PATCH] plugged two memmory leaks happening when a requested font is not found. git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@691 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_gfx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/rrd_gfx.c b/src/rrd_gfx.c index 7084720..1d46a85 100644 --- a/src/rrd_gfx.c +++ b/src/rrd_gfx.c @@ -303,10 +303,15 @@ double gfx_get_text_width_libart ( FT_Init_FreeType( &library ); error = FT_New_Face( library, font, 0, &face ); - if ( error ) return -1; + if ( error ) { + FT_Done_FreeType(library); + return -1; + } error = FT_Set_Char_Size(face, size*64,size*64, 100,100); - if ( error ) return -1; - + if ( error ) { + FT_Done_FreeType(library); + return -1; + } string = gfx_string_create( canvas, face, text, rotation, tabwidth, size ); text_width = string->width; gfx_string_destroy(string); @@ -602,6 +607,7 @@ int gfx_render_png (gfx_canvas_t *canvas, &face ); if ( error ) { rrd_set_error("failed to load %s",node->filename); + break; } error = FT_Set_Char_Size(face, /* handle to face object */ -- 2.11.0