SF.net SVN: geany-plugins:[1216] trunk/geanylatex/src/geanylatex.c

frlan at users.sourceforge.net frlan at xxxxx
Sat Mar 27 14:34:59 UTC 2010


Revision: 1216
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1216&view=rev
Author:   frlan
Date:     2010-03-27 14:34:58 +0000 (Sat, 27 Mar 2010)

Log Message:
-----------
GeanyLaTeX: Fix a memory leak on title handling of wizard

Modified Paths:
--------------
    trunk/geanylatex/src/geanylatex.c

Modified: trunk/geanylatex/src/geanylatex.c
===================================================================
--- trunk/geanylatex/src/geanylatex.c	2010-03-27 14:34:35 UTC (rev 1215)
+++ trunk/geanylatex/src/geanylatex.c	2010-03-27 14:34:58 UTC (rev 1216)
@@ -1606,32 +1606,35 @@
 
 			if (title != NULL)
 			{
-				if (title[0] != '\0')
+				gchar *title_string = NULL;
+				if (documentclass_int == 3)
 				{
-					if (documentclass_int == 3)
-					{
-						title = g_strconcat("\\subject{", title, "}\n", NULL);
-					}
-					else
-					{
-						title = g_strconcat("\\title{", title, "}\n", NULL);
-					}
-
-					utils_string_replace_all(code, "{TITLE}", title);
+					title_string = g_strconcat("\\subject{", title, "}\n", NULL);
 				}
 				else
-					if (documentclass_int == 3)
-					{
-						utils_string_replace_all(code, "{TITLE}", "\% \\subject{} \n");
-					}
-					else
-					{
-						utils_string_replace_all(code, "{TITLE}", "\% \\title{} \n");
-					}
+				{
+					title_string = g_strconcat("\\title{", title, "}\n", NULL);
+				}
 
+				utils_string_replace_all(code, "{TITLE}", title_string);
 				g_free(title);
+				g_free(title_string);
 			}
-
+			else
+			{
+				if (documentclass_int == 3)
+				{
+					utils_string_replace_all(code, "{TITLE}", "\% \\subject{} \n");
+				}
+				else
+				{
+					utils_string_replace_all(code, "{TITLE}", "\% \\title{} \n");
+				}
+				if (title != NULL)
+				{
+					g_free(title);
+				}
+			}
 			utils_string_replace_all(code, "{OPENING}", _("Dear Sir or Madame"));
 			utils_string_replace_all(code, "{CLOSING}", _("With kind regards"));
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list