From 5c3a9e76a627d590eb8f785e86af817bd62ca48e 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@691 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_gfx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/program/src/rrd_gfx.c b/program/src/rrd_gfx.c index 7084720b..1d46a858 100644 --- a/program/src/rrd_gfx.c +++ b/program/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.30.2