SF.net SVN: geany: [2399] trunk/src/symbols.c
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon Mar 24 17:24:44 UTC 2008
Revision: 2399
http://geany.svn.sourceforge.net/geany/?rev=2399&view=rev
Author: ntrel
Date: 2008-03-24 10:24:39 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
Fix memory leaks when using tm_tags_extract().
Modified Paths:
--------------
trunk/src/symbols.c
Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c 2008-03-24 17:02:50 UTC (rev 2398)
+++ trunk/src/symbols.c 2008-03-24 17:24:39 UTC (rev 2399)
@@ -211,7 +211,8 @@
}
}
}
- g_ptr_array_free(typedefs, TRUE);
+ if (typedefs)
+ g_ptr_array_free(typedefs, TRUE);
return s;
}
@@ -246,7 +247,6 @@
GString *symbols_get_macro_list(void)
{
guint j, i;
- const GPtrArray *tags;
GPtrArray *ftags;
GString *words;
@@ -258,6 +258,8 @@
for (j = 0; j < app->tm_workspace->work_objects->len; j++)
{
+ GPtrArray *tags;
+
tags = tm_tags_extract(TM_WORK_OBJECT(app->tm_workspace->work_objects->pdata[j])->tags_array,
tm_tag_enum_t | tm_tag_variable_t | tm_tag_macro_t | tm_tag_macro_with_arg_t);
if (NULL != tags)
@@ -266,6 +268,7 @@
{
g_ptr_array_add(ftags, (gpointer) tags->pdata[i]);
}
+ g_ptr_array_free(tags, TRUE);
}
}
tm_tags_sort(ftags, NULL, FALSE);
@@ -297,7 +300,7 @@
static TMTag *find_work_object_tag(const TMWorkObject *workobj,
const gchar *tag_name, gint type)
{
- const GPtrArray *tags;
+ GPtrArray *tags;
TMTag *tmtag;
if (workobj != NULL)
@@ -306,6 +309,9 @@
if (tags != NULL)
{
tmtag = symbols_find_tm_tag(tags, tag_name);
+
+ g_ptr_array_free(tags, TRUE);
+
if (tmtag != NULL)
return tmtag;
}
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