From 4efc4a43ff481661990b304f9599f811db39f7dc Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 20 Mar 2021 20:11:25 +0000 Subject: cid#1474277 Resource leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and... cid#1474319 Resource leak cid#1473965 Resource leak cid#1474109 Resource leak cid#1474179 Resource leak Change-Id: I7daba2a0173a7fe7a912c0febf7957667f0fae83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112822 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- .../qa/gtktiledviewer/gtv-signal-handlers.cxx | 42 +++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'libreofficekit') diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx index fef712ceef0a..be7cd4445536 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx @@ -38,8 +38,8 @@ void btn_clicked(GtkWidget* pButton, gpointer) GtvHelpers::userPromptDialog(GTK_WINDOW(window), "Insert Comment", aEntries); boost::property_tree::ptree aTree; - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string"); - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]); + aTree.put(boost::property_tree::ptree::path_type("Text/type", '/'), "string"); + aTree.put(boost::property_tree::ptree::path_type("Text/value", '/'), aEntries["Text"]); std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); @@ -191,8 +191,12 @@ static void iterateUnoParams(GtkWidget* pWidget, gpointer userdata) unoParam[i] = gtk_entry_get_text(GTK_ENTRY(pIt->data)); } - pTree->put(boost::property_tree::ptree::path_type(g_strconcat(unoParam[1], "/", "type", nullptr), '/'), unoParam[0]); - pTree->put(boost::property_tree::ptree::path_type(g_strconcat(unoParam[1], "/", "value", nullptr), '/'), unoParam[2]); + gchar* pPath = g_strconcat(unoParam[1], "/", "type", nullptr); + pTree->put(boost::property_tree::ptree::path_type(pPath, '/'), unoParam[0]); + g_free(pPath); + pPath = g_strconcat(unoParam[1], "/", "value", nullptr); + pTree->put(boost::property_tree::ptree::path_type(pPath, '/'), unoParam[2]); + g_free(pPath); } void recentUnoChanged( GtkWidget* pSelector, gpointer /* pItem */ ) @@ -256,11 +260,9 @@ void unoCommandDebugger(GtkWidget* pButton, gpointer /* pItem */) gtk_widget_show_all(pUnoCmdDialog); gint res = gtk_dialog_run (GTK_DIALOG(pUnoCmdDialog)); - switch (res) - { - case GTK_RESPONSE_OK: + if (res == GTK_RESPONSE_OK) { - const gchar* sUnoCmd = g_strconcat(".uno:", gtk_entry_get_text(GTK_ENTRY(pUnoCmdEntry)), nullptr); + gchar* sUnoCmd = g_strconcat(".uno:", gtk_entry_get_text(GTK_ENTRY(pUnoCmdEntry)), nullptr); boost::property_tree::ptree aTree; gtk_container_foreach(GTK_CONTAINER(pUnoParamAreaBox), iterateUnoParams, &aTree); @@ -273,8 +275,8 @@ void unoCommandDebugger(GtkWidget* pButton, gpointer /* pItem */) lok_doc_view_post_command(LOK_DOC_VIEW(window->lokdocview), sUnoCmd, (aArguments.empty() ? nullptr : aArguments.c_str()), false); addToRecentUnoCommands(window, sUnoCmd, aArguments); - } - break; + + g_free(sUnoCmd); } gtk_widget_destroy(pUnoCmdDialog); @@ -649,11 +651,11 @@ void editButtonClicked(GtkWidget* pWidget, gpointer userdata) gchar *commentId = static_cast(g_object_get_data(G_OBJECT(userdata), "id")); boost::property_tree::ptree aTree; - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "string"); - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentId)); + aTree.put(boost::property_tree::ptree::path_type("Id/type", '/'), "string"); + aTree.put(boost::property_tree::ptree::path_type("Id/value", '/'), std::string(commentId)); - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string"); - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]); + aTree.put(boost::property_tree::ptree::path_type("Text/type", '/'), "string"); + aTree.put(boost::property_tree::ptree::path_type("Text/value", '/'), aEntries["Text"]); std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); @@ -673,11 +675,11 @@ void replyButtonClicked(GtkWidget* pWidget, gpointer userdata) gchar *commentId = static_cast(g_object_get_data(G_OBJECT(userdata), "id")); boost::property_tree::ptree aTree; - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "string"); - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentId)); + aTree.put(boost::property_tree::ptree::path_type("Id/type", '/'), "string"); + aTree.put(boost::property_tree::ptree::path_type("Id/value", '/'), std::string(commentId)); - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string"); - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]); + aTree.put(boost::property_tree::ptree::path_type("Text/type", '/'), "string"); + aTree.put(boost::property_tree::ptree::path_type("Text/value", '/'), aEntries["Text"]); std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); @@ -697,8 +699,8 @@ void deleteCommentButtonClicked(GtkWidget* pWidget, gpointer userdata) gchar *commentid = static_cast(g_object_get_data(G_OBJECT(userdata), "id")); boost::property_tree::ptree aTree; - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "string"); - aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentid)); + aTree.put(boost::property_tree::ptree::path_type("Id/type", '/'), "string"); + aTree.put(boost::property_tree::ptree::path_type("Id/value", '/'), std::string(commentid)); std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); -- cgit