SF.net SVN: geany:[4810] trunk/src/editor.c

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Apr 8 15:56:09 UTC 2010


Revision: 4810
          http://geany.svn.sourceforge.net/geany/?rev=4810&view=rev
Author:   ntrel
Date:     2010-04-08 15:56:08 +0000 (Thu, 08 Apr 2010)

Log Message:
-----------
Fix mem leak with snippets_find_completion_by_name().

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

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2010-04-08 13:54:08 UTC (rev 4809)
+++ trunk/src/editor.c	2010-04-08 15:56:08 UTC (rev 4810)
@@ -2009,7 +2009,8 @@
 	return ret;
 }
 
-static gchar *snippets_find_completion_by_name(const gchar *type, const gchar *name)
+
+static const gchar *snippets_find_completion_by_name(const gchar *type, const gchar *name)
 {
 	gchar *result = NULL;
 	GHashTable *tmp;
@@ -2034,7 +2035,7 @@
 	/* if result is still NULL here, no completion could be found */
 
 	/* result is owned by the hash table and will be freed when the table will destroyed */
-	return g_strdup(result);
+	return result;
 }
 
 
@@ -2366,7 +2367,7 @@
 {
 	gboolean result = FALSE;
 	gint lexer, style;
-	gchar *wc;
+	const gchar *wc;
 	const gchar *word;
 	ScintillaObject *sci;
 
@@ -2397,8 +2398,6 @@
 		if (result)
 			sci_cancel(sci);	/* cancel any autocompletion list, etc */
 	}
-
-	g_free(wc);
 	return result;
 }
 


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



More information about the Commits mailing list