[geany/geany-plugins] 42afea: Merge pull request #391 from b4n/lineoperations/leak

Frank Lanitz git-noreply at xxxxx
Tue Mar 8 17:41:50 UTC 2016


Branch:      refs/heads/master
Author:      Frank Lanitz <frank at frank.uvena.de>
Committer:   Frank Lanitz <frank at frank.uvena.de>
Date:        Tue, 08 Mar 2016 17:41:50 UTC
Commit:      42afeaed5f52dc88893c91cf970f997f621459f7
             https://github.com/geany/geany-plugins/commit/42afeaed5f52dc88893c91cf970f997f621459f7

Log Message:
-----------
Merge pull request #391 from b4n/lineoperations/leak

lineoperations: Fix a memory leak found by cppcheck


Modified Paths:
--------------
    lineoperations/src/linefunctions.c

Modified: lineoperations/src/linefunctions.c
4 lines changed, 0 insertions(+), 4 deletions(-)
===================================================================
@@ -286,17 +286,13 @@ void rmwhspln(GeanyDocument *doc) {
 
 /* Sort Lines Ascending and Descending */
 void sortlines(GeanyDocument *doc, gboolean asc) {
-	gint  total_num_chars;  /* number of characters in the document */
 	gint  total_num_lines;  /* number of lines in the document */
 	gchar **lines;          /* array to hold all lines in the document */
 	gchar *new_file;        /* *final* string to replace current document */
 	gint  i;                /* iterator */
 
-	total_num_chars = sci_get_length(doc->editor->sci);
 	total_num_lines = sci_get_line_count(doc->editor->sci);
 	lines           = g_malloc(sizeof(gchar *) * (total_num_lines+1));
-	new_file        = g_malloc(sizeof(gchar) * (total_num_chars+1));
-	new_file[0]     = '\0';
 
 	/* if file is not empty, ensure that the file ends with newline */
 	if(total_num_lines != 1)



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