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
This commit is contained in:
Nick Treleaven 2010-04-08 15:56:08 +00:00
parent e7d790d926
commit 664333b8c8

View File

@ -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;
}