From 664333b8c841df5a7b6e04e55e5d8324e59acb89 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Thu, 8 Apr 2010 15:56:08 +0000 Subject: [PATCH] Fix mem leak with snippets_find_completion_by_name(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4810 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- src/editor.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/editor.c b/src/editor.c index bcab91e8..d4ced194 100644 --- a/src/editor.c +++ b/src/editor.c @@ -2009,7 +2009,8 @@ gboolean editor_start_auto_complete(GeanyEditor *editor, gint pos, gboolean forc 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 @@ static gchar *snippets_find_completion_by_name(const gchar *type, const gchar *n /* 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 editor_complete_snippet(GeanyEditor *editor, gint pos) { gboolean result = FALSE; gint lexer, style; - gchar *wc; + const gchar *wc; const gchar *word; ScintillaObject *sci; @@ -2397,8 +2398,6 @@ gboolean editor_complete_snippet(GeanyEditor *editor, gint pos) if (result) sci_cancel(sci); /* cancel any autocompletion list, etc */ } - - g_free(wc); return result; }