From 107ec13506484b10f63424c65f3bb67142265049 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sun, 6 Feb 2011 17:57:37 +0100 Subject: Fix a memory leak in LdDiagramSymbol. --- liblogdiag/ld-canvas.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'liblogdiag/ld-canvas.c') diff --git a/liblogdiag/ld-canvas.c b/liblogdiag/ld-canvas.c index 84aaf67..564a838 100644 --- a/liblogdiag/ld-canvas.c +++ b/liblogdiag/ld-canvas.c @@ -1022,11 +1022,16 @@ is_object_selected (LdCanvas *self, LdDiagramObject *object) static LdSymbol * resolve_diagram_symbol (LdCanvas *self, LdDiagramSymbol *diagram_symbol) { + LdSymbol *symbol; + gchar *klass; + if (!self->priv->library) return NULL; - return ld_library_find_symbol (self->priv->library, - ld_diagram_symbol_get_class (diagram_symbol)); + klass = ld_diagram_symbol_get_class (diagram_symbol); + symbol = ld_library_find_symbol (self->priv->library, klass); + g_free (klass); + return symbol; } static gboolean @@ -1789,8 +1794,11 @@ draw_symbol (LdDiagramSymbol *diagram_symbol, DrawData *data) /* TODO: Resolve this better; draw a cross or whatever. */ if (!symbol) { - g_warning ("cannot find symbol `%s' in the library", - ld_diagram_symbol_get_class (diagram_symbol)); + gchar *klass; + + klass = ld_diagram_symbol_get_class (diagram_symbol); + g_warning ("cannot find symbol `%s' in the library", klass); + g_free (klass); return; } -- cgit v1.2.3-70-g09d2