[geany/geany] 17396a: Fix a memory leak in tm_get_current_function()
Colomban Wendling
git-noreply at xxxxx
Mon Sep 17 12:44:32 UTC 2012
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Mon, 17 Sep 2012 12:44:32
Commit: 17396aaa999a6a2ce91f190d7aac56492c945712
https://github.com/geany/geany/commit/17396aaa999a6a2ce91f190d7aac56492c945712
Log Message:
-----------
Fix a memory leak in tm_get_current_function()
Modified Paths:
--------------
tagmanager/src/tm_workspace.c
Modified: tagmanager/src/tm_workspace.c
10 files changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -736,16 +736,16 @@ static gboolean match_langs(gint lang, const TMTag *tag)
tm_get_current_function (GPtrArray * file_tags, const gulong line)
{
GPtrArray *const local = tm_tags_extract (file_tags, tm_tag_function_t);
+ TMTag *function_tag = NULL;
if (local && local->len)
{
guint i;
- TMTag *tag, *function_tag = NULL;
gulong function_line = 0;
glong delta;
for (i = 0; (i < local->len); ++i)
{
- tag = TM_TAG (local->pdata[i]);
+ TMTag *tag = TM_TAG (local->pdata[i]);
delta = line - tag->atts.entry.line;
if (delta >= 0 && (gulong)delta < line - function_line)
{
@@ -753,10 +753,10 @@ static gboolean match_langs(gint lang, const TMTag *tag)
function_line = tag->atts.entry.line;
}
}
- g_ptr_array_free (local, TRUE);
- return function_tag;
}
- return NULL;
+ if (local)
+ g_ptr_array_free (local, TRUE);
+ return function_tag;
}
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Commits
mailing list