diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2011-02-06 17:57:37 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2011-02-06 17:57:37 +0100 |
commit | 107ec13506484b10f63424c65f3bb67142265049 (patch) | |
tree | 9400d73cf336685b413f4d8273e552c5777f7dbb /liblogdiag/ld-canvas.c | |
parent | 7f08a51c6615242273f92cf69489d7cb540b7826 (diff) | |
download | logdiag-107ec13506484b10f63424c65f3bb67142265049.tar.gz logdiag-107ec13506484b10f63424c65f3bb67142265049.tar.xz logdiag-107ec13506484b10f63424c65f3bb67142265049.zip |
Fix a memory leak in LdDiagramSymbol.
Diffstat (limited to 'liblogdiag/ld-canvas.c')
-rw-r--r-- | liblogdiag/ld-canvas.c | 16 |
1 files changed, 12 insertions, 4 deletions
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; } |