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

frlan at users.sourceforge.net frlan at xxxxx
Sat Mar 27 14:33:49 UTC 2010


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

Log Message:
-----------
GeanyLaTeX: Fix a memory leak on author section of wiazrd

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

Modified: trunk/geanylatex/src/geanylatex.c
===================================================================
--- trunk/geanylatex/src/geanylatex.c	2010-03-27 10:00:46 UTC (rev 1212)
+++ trunk/geanylatex/src/geanylatex.c	2010-03-27 14:33:49 UTC (rev 1213)
@@ -1553,33 +1553,37 @@
 					break;
 				}
 			}
-			if (author != NULL)
+			if (NZV(author))
 			{
-				if (author[0] != '\0')
+				gchar* author_string = NULL;
+				if (documentclass_int == 3)
+			  	{
+			  		author_string = g_strconcat("\\signature{", author, "}\n", NULL);
+				}
+			  	else
 				{
-					if (documentclass_int == 3)
-				  	{
-				  		author = g_strconcat("\\signature{", author, "}\n", NULL);
-					}
-				  	else
-					{
-						author = g_strconcat("\\author{", author, "}\n", NULL);
-					}
-
-					utils_string_replace_all(code, "{AUTHOR}", author);
+					author_string = g_strconcat("\\author{", author, "}\n", NULL);
 				}
+				utils_string_replace_all(code, "{AUTHOR}", author_string);
+				g_free(author);
+				g_free(author_string);
+			}
+			else
+			{
+				gchar* author_string = NULL;
+				if (documentclass_int == 3)
+				{
+					utils_string_replace_all(code, "{AUTHOR}", "\% \\signature{}\n");
+				}
 				else
-					if (documentclass_int == 3)
-					{
-						utils_string_replace_all(code, "{AUTHOR}", "\% \\signature{}\n");
-					}
-					else
-					{
-						utils_string_replace_all(code, "{AUTHOR}", "\% \\author{}\n");
-					}
-
+				{
+					utils_string_replace_all(code, "{AUTHOR}", "\% \\author{}\n");
+				}
+				utils_string_replace_all(code, "{AUTHOR}", author_string);
 				g_free(author);
+				g_free(author_string);
 			}
+
 			if (date != NULL)
 			{
 				if (date[0] != '\0')


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