Pango leaks
- From: Alexander Larsson <alla lysator liu se>
- To: gtk-devel-list gnome org
- Cc: otaylor redhat com
- Subject: Pango leaks
- Date: Tue, 23 Jan 2001 12:32:15 +0100 (CET)
There seems to be some leaks in pango. Can i check in this patch?
/ Alex
The item->extra_attrs slist is never freed.
Index: pango/pango-item.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-item.c,v
retrieving revision 1.3
diff -u -p -r1.3 pango-item.c
--- pango/pango-item.c 2000/12/02 07:49:55 1.3
+++ pango/pango-item.c 2001/01/23 11:26:56
@@ -81,7 +81,10 @@ void
pango_item_free (PangoItem *item)
{
if (item->extra_attrs)
- g_slist_foreach (item->extra_attrs, (GFunc)pango_attribute_destroy, NULL);
+ {
+ g_slist_foreach (item->extra_attrs, (GFunc)pango_attribute_destroy, NULL);
+ g_slist_free (item->extra_attrs);
+ }
g_object_unref (G_OBJECT (item->analysis.font));
new_item is initialized to a copy of item, and then overwritten.
Index: pango/pango-layout.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-layout.c,v
retrieving revision 1.53
diff -u -p -r1.53 pango-layout.c
--- pango/pango-layout.c 2001/01/22 23:08:09 1.53
+++ pango/pango-layout.c 2001/01/23 11:26:59
@@ -2345,7 +2345,7 @@ process_item (PangoLayout *layout,
}
else
{
- PangoItem *new_item = pango_item_copy (item);
+ PangoItem *new_item;
length = g_utf8_offset_to_pointer (text + item->offset, break_num_chars) - (text + item->offset);
If the config file open fails the GString buffers leak.
Index: pango/pango-utils.c
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-utils.c,v
retrieving revision 1.13
diff -u -p -r1.13 pango-utils.c
--- pango/pango-utils.c 2000/11/30 23:08:53 1.13
+++ pango/pango-utils.c 2001/01/23 11:27:00
@@ -429,9 +429,9 @@ read_config_file (const char *filename,
{
FILE *file;
- GString *line_buffer = g_string_new (NULL);
- GString *tmp_buffer1 = g_string_new (NULL);
- GString *tmp_buffer2 = g_string_new (NULL);
+ GString *line_buffer;
+ GString *tmp_buffer1;
+ GString *tmp_buffer2;
char *errstring = NULL;
const char *pos;
char *section = NULL;
@@ -446,6 +446,10 @@ read_config_file (const char *filename,
return;
}
+ line_buffer = g_string_new (NULL);
+ tmp_buffer1 = g_string_new (NULL);
+ tmp_buffer2 = g_string_new (NULL);
+
while (pango_read_line (file, line_buffer))
{
line++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]