Skip to content

Commit

Permalink
pretty-printer: Fix huge memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
b4n committed Feb 20, 2016
1 parent 15bc6c4 commit df88b17
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pretty-printer/src/PluginEntry.c
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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);
}

0 comments on commit df88b17

Please sign in to comment.