From 3287d74280ba8f915220e14e1ddd6776cdcefa22 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 11 Sep 2007 14:26:07 +0000 Subject: [PATCH] fix memory leaks --- filter-leak.patch | 43 +++++++++++++++++++++++++++++++++++++++++++ librsvg2.spec | 9 ++++++++- stack-leak.patch | 12 ++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 filter-leak.patch create mode 100644 stack-leak.patch diff --git a/filter-leak.patch b/filter-leak.patch new file mode 100644 index 0000000..9b5c594 --- /dev/null +++ b/filter-leak.patch @@ -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; + } + diff --git a/librsvg2.spec b/librsvg2.spec index b7f6bad..e4dda63 100644 --- a/librsvg2.spec +++ b/librsvg2.spec @@ -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 - 2.18.2-2 +- Plug memory leaks + * Mon Sep 3 2007 Matthias Clasen - 2.18.2-1 - Update to 2.18.2 diff --git a/stack-leak.patch b/stack-leak.patch new file mode 100644 index 0000000..b86fab9 --- /dev/null +++ b/stack-leak.patch @@ -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");