[geany/geany-plugins] 06b757: Addons: XMLtagging: Try to fix a memory leak

Frank Lanitz git-noreply at xxxxx
Mon Nov 4 08:16:09 UTC 2013


Branch:      refs/heads/master
Author:      Frank Lanitz <frank at frank.uvena.de>
Committer:   Frank Lanitz <frank at frank.uvena.de>
Date:        Mon, 04 Nov 2013 08:16:09 UTC
Commit:      06b7576980ef0c3a008de064d0f6b5793973c44b
             https://github.com/geany/geany-plugins/commit/06b7576980ef0c3a008de064d0f6b5793973c44b

Log Message:
-----------
Addons: XMLtagging: Try to fix a memory leak


Modified Paths:
--------------
    addons/src/ao_xmltagging.c

Modified: addons/src/ao_xmltagging.c
6 files changed, 4 insertions(+), 2 deletions(-)
===================================================================
@@ -84,7 +84,7 @@ void ao_xmltagging(void)
 
 		if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
 		{
-			const gchar *tag = NULL;
+			gchar *tag = NULL;
 
 			selection = sci_get_selection_contents(doc->editor->sci);
 			sci_start_undo_action(doc->editor->sci);
@@ -94,7 +94,7 @@ void ao_xmltagging(void)
 			{
 				gsize end = 0;
 				GString *tmp = NULL;
-				const gchar *end_tag;
+				gchar *end_tag;
 
 				/* First we check for %s and replace it with selection*/
 				tmp = g_string_new(tag);
@@ -117,12 +117,14 @@ void ao_xmltagging(void)
 				}
 				replacement = g_strconcat("<", tag, ">",
 								selection, "</", end_tag, ">", NULL);
+				g_free(end_tag);
 			}
 
 			sci_replace_sel(doc->editor->sci, replacement);
 			sci_end_undo_action(doc->editor->sci);
 			g_free(selection);
 			g_free(replacement);
+			g_free(tag);
 		}
 		gtk_widget_destroy(dialog);
 	}



--------------
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