From 9e9eda4a34ce2afee9a78737c2d5d94373d625a7 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Tue, 6 Nov 2018 10:59:04 +0100 Subject: fix memory leak in ClipboardManagerImpl --- src/ui/clipboard.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index b2d8fe58b..a18df5675 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -1245,7 +1245,8 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/) // FIXME: Temporary hack until we add support for memory output. // Save to a temporary file, read it back and then set the clipboard contents gchar *filename = g_build_filename( g_get_user_cache_dir(), "inkscape-clipboard-export", NULL ); - gsize len; gchar *data; + gchar *data = nullptr; + gsize len; try { if (out == outlist.end() && target == "image/png") @@ -1288,6 +1289,7 @@ void ClipboardManagerImpl::_onGet(Gtk::SelectionData &sel, guint /*info*/) g_unlink(filename); // delete the temporary file g_free(filename); + g_free(data); } -- cgit v1.2.3