Revision: 838 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=838&view=rev Author: frlan Date: 2009-07-18 00:15:50 +0000 (Sat, 18 Jul 2009)
Log Message: ----------- GeanyLaTeX: Try to fix some more memory leaks
Modified Paths: -------------- trunk/geanylatex/src/formatutils.c trunk/geanylatex/src/latexenvironments.c trunk/geanylatex/src/latexstructure.c trunk/geanylatex/src/latexutils.c trunk/geanylatex/src/reftex.c
Modified: trunk/geanylatex/src/formatutils.c =================================================================== --- trunk/geanylatex/src/formatutils.c 2009-07-18 00:15:19 UTC (rev 837) +++ trunk/geanylatex/src/formatutils.c 2009-07-18 00:15:50 UTC (rev 838) @@ -34,7 +34,7 @@ if (sci_has_selection(doc->editor->sci)) { gchar *selection; - const gchar *replacement = NULL; + gchar *replacement = NULL;
selection = sci_get_selection_contents(doc->editor->sci);
@@ -43,6 +43,7 @@
sci_replace_sel(doc->editor->sci, replacement); g_free(selection); + g_free(replacement); } else {
Modified: trunk/geanylatex/src/latexenvironments.c =================================================================== --- trunk/geanylatex/src/latexenvironments.c 2009-07-18 00:15:19 UTC (rev 837) +++ trunk/geanylatex/src/latexenvironments.c 2009-07-18 00:15:50 UTC (rev 838) @@ -79,6 +79,7 @@
sci_replace_sel(doc->editor->sci, replacement); g_free(selection); + g_free(replacement); } else { @@ -90,8 +91,10 @@ tmpstring = g_string_new("\begin{"); g_string_append(tmpstring, environment); g_string_append(tmpstring, "}\n"); + if (type == GLATEX_ENVIRONMENT_TYPE_LIST) g_string_append(tmpstring, "\item \n"); + g_string_append(tmpstring, "\end{"); g_string_append(tmpstring, environment); g_string_append(tmpstring,"}\n");
Modified: trunk/geanylatex/src/latexstructure.c =================================================================== --- trunk/geanylatex/src/latexstructure.c 2009-07-18 00:15:19 UTC (rev 837) +++ trunk/geanylatex/src/latexstructure.c 2009-07-18 00:15:50 UTC (rev 838) @@ -90,12 +90,16 @@ ) > 0) { tmp = g_string_free(haystack, FALSE); + haystack = NULL; sci_replace_sel(doc->editor->sci, tmp); g_free(tmp); sci_end_undo_action(doc->editor->sci); break; } } + + if (haystack != NULL) + g_string_free(haystack, TRUE); }
void glatex_structure_lvldown() @@ -126,9 +130,13 @@ > 0) { tmp = g_string_free(haystack, FALSE); + haystack = NULL; sci_replace_sel(doc->editor->sci, tmp); g_free(tmp); break; } } + + if (haystack != NULL) + g_string_free(haystack, TRUE); }
Modified: trunk/geanylatex/src/latexutils.c =================================================================== --- trunk/geanylatex/src/latexutils.c 2009-07-18 00:15:19 UTC (rev 837) +++ trunk/geanylatex/src/latexutils.c 2009-07-18 00:15:50 UTC (rev 838) @@ -62,6 +62,7 @@ { locale_filename = utils_get_locale_from_utf8(doc->file_name); tmp = g_string_new(locale_filename); + g_free(locale_filename); utils_string_replace_all(tmp, ".tex", ".aux");
return g_string_free(tmp, FALSE);
Modified: trunk/geanylatex/src/reftex.c =================================================================== --- trunk/geanylatex/src/reftex.c 2009-07-18 00:15:19 UTC (rev 837) +++ trunk/geanylatex/src/reftex.c 2009-07-18 00:15:50 UTC (rev 838) @@ -29,7 +29,8 @@ const gchar *file = NULL; int i = 0; LaTeXLabel tmp; - if (dir != NULL) + + if (file != NULL) { file = g_dir_read_name(dir); ui_set_statusbar(FALSE, file); @@ -69,6 +70,7 @@ l++; x++; } + g_free(t); } label.label_name = g_strndup(line, l);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org