[geany/geany-plugins] df88b1: pretty-printer: Fix huge memory leak

Colomban Wendling git-noreply at xxxxx
Thu Jun 9 13:09:17 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 20 Feb 2016 18:49:14 UTC
Commit:      df88b177a8b6cfd778342474f15b8c79a54eda4b
             https://github.com/geany/geany-plugins/commit/df88b177a8b6cfd778342474f15b8c79a54eda4b

Log Message:
-----------
pretty-printer: Fix huge memory leak


Modified Paths:
--------------
    pretty-printer/src/PluginEntry.c

Modified: pretty-printer/src/PluginEntry.c
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -140,6 +140,7 @@ void xml_format(GtkMenuItem* menuitem, gpointer gdata)
     /* this is not a valid xml => exit with an error message */
     if(parsedDocument == NULL)
     {
+        g_free(buffer);
         dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("Unable to parse the content as XML."));
         return;
     }
@@ -151,6 +152,7 @@ void xml_format(GtkMenuItem* menuitem, gpointer gdata)
     result = processXMLPrettyPrinting(&buffer, &length, prettyPrintingOptions);
     if (result != PRETTY_PRINTING_SUCCESS)
     {
+        g_free(buffer);
         dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("Unable to process PrettyPrinting on the specified XML because some features are not supported.\n\nSee Help > Debug messages for more details..."));
         return;
     }
@@ -165,4 +167,6 @@ void xml_format(GtkMenuItem* menuitem, gpointer gdata)
     /* sets the type */
     fileType = filetypes_index(GEANY_FILETYPES_XML);
     document_set_filetype(doc, fileType);
+
+    g_free(buffer);
 }



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list