fix memory leaks

This commit is contained in:
Matthias Clasen 2007-09-11 14:26:07 +00:00
parent 06953c6ee4
commit 3287d74280
3 changed files with 63 additions and 1 deletions

43
filter-leak.patch Normal file
View File

@ -0,0 +1,43 @@
diff -up librsvg-2.18.2/rsvg-filter.c.filter-leak librsvg-2.18.2/rsvg-filter.c
--- librsvg-2.18.2/rsvg-filter.c.filter-leak 2007-09-11 10:03:39.000000000 -0400
+++ librsvg-2.18.2/rsvg-filter.c 2007-09-11 10:04:24.000000000 -0400
@@ -703,7 +703,6 @@ rsvg_new_filter (void)
filter->y = _rsvg_css_parse_length ("-10%");
filter->width = _rsvg_css_parse_length ("120%");
filter->height = _rsvg_css_parse_length ("120%");
- filter->super.children = g_ptr_array_new ();
filter->super.set_atts = rsvg_filter_set_args;
return (RsvgNode *) filter;
}
@@ -1702,7 +1701,6 @@ rsvg_new_filter_primitive_merge (void)
filter->super.super.free = &rsvg_filter_primitive_merge_free;
filter->super.super.set_atts = rsvg_filter_primitive_merge_set_atts;
- filter->super.super.children = g_ptr_array_new ();
return (RsvgNode *) filter;
}
@@ -2201,7 +2199,6 @@ rsvg_new_filter_primitive_component_tran
filter->super.super.set_atts = rsvg_filter_primitive_component_transfer_set_atts;
- filter->super.super.children = g_ptr_array_new ();
return (RsvgNode *) filter;
}
@@ -4088,7 +4085,6 @@ rsvg_new_filter_primitive_diffuse_lighti
filter->super.render = &rsvg_filter_primitive_diffuse_lighting_render;
filter->super.super.free = &rsvg_filter_primitive_diffuse_lighting_free;
filter->super.super.set_atts = rsvg_filter_primitive_diffuse_lighting_set_atts;
- filter->super.super.children = g_ptr_array_new ();
return (RsvgNode *) filter;
}
@@ -4267,7 +4263,6 @@ rsvg_new_filter_primitive_specular_light
filter->super.render = &rsvg_filter_primitive_specular_lighting_render;
filter->super.super.free = &rsvg_filter_primitive_specular_lighting_free;
filter->super.super.set_atts = rsvg_filter_primitive_specular_lighting_set_atts;
- filter->super.super.children = g_ptr_array_new ();
return (RsvgNode *) filter;
}

View File

@ -12,11 +12,13 @@
Name: librsvg2
Summary: An SVG library based on cairo
Version: 2.18.2
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
Source: http://download.gnome.org/sources/librsvg/2.18/librsvg-%{version}.tar.bz2
Patch0: stack-leak.patch
Patch1: filter-leak.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: gtk2 >= %{gtk2_version}
Requires: libxml2 >= %{libxml2_version}
@ -63,6 +65,8 @@ files to allow you to develop with librsvg.
%prep
%setup -q -n librsvg-%{version}
%patch0 -p1 -b .stack-leak
%patch1 -p1 -b .filter-leak
%build
%configure --with-svgz \
@ -118,6 +122,9 @@ rm -rf $RPM_BUILD_ROOT
%doc %{_datadir}/gtk-doc/html/rsvg
%changelog
* Tue Sep 11 2007 Matthias Clasen <mclasen@redhat.com> - 2.18.2-2
- Plug memory leaks
* Mon Sep 3 2007 Matthias Clasen <mclasen@redhat.com> - 2.18.2-1
- Update to 2.18.2

12
stack-leak.patch Normal file
View File

@ -0,0 +1,12 @@
diff -up librsvg-2.18.2/rsvg-cairo-draw.c.stack-leak librsvg-2.18.2/rsvg-cairo-draw.c
--- librsvg-2.18.2/rsvg-cairo-draw.c.stack-leak 2007-09-11 09:34:39.000000000 -0400
+++ librsvg-2.18.2/rsvg-cairo-draw.c 2007-09-11 09:35:03.000000000 -0400
@@ -981,7 +981,7 @@ rsvg_cairo_pop_render_stack (RsvgDrawing
GdkPixbuf *pixbuf = render->pixbuf_stack->data;
GdkPixbuf *bg = rsvg_compile_bg (ctx);
- render->pixbuf_stack = g_list_remove_link (render->pixbuf_stack, render->pixbuf_stack);
+ render->pixbuf_stack = g_list_remove (render->pixbuf_stack, pixbuf);
output = rsvg_filter_render (state->filter, pixbuf, bg, ctx, &render->bbox, "2103");