After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 761728 - memory leak RsvgFilterPrimitiveComponentTransfer
memory leak RsvgFilterPrimitiveComponentTransfer
Status: RESOLVED FIXED
Product: librsvg
Classification: Core
Component: general
2.40.x
Other Linux
: Normal major
: ---
Assigned To: librsvg maintainers
librsvg maintainers
Depends on:
Blocks:
 
 
Reported: 2016-02-08 19:37 UTC by Ron Hopper
Modified: 2016-03-31 01:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to add destructor (1.35 KB, patch)
2016-02-08 21:27 UTC, Ron Hopper
none Details | Review

Description Ron Hopper 2016-02-08 19:37:30 UTC
The constructor "rsvg_new_filter_primitive_component_transfer" does not set a destructor.

The following code corrects the memory leak:
-----------------------------------------------------------------

static void
rsvg_filter_primitive_component_transfer_free (RsvgNode * self)
{
   RsvgFilterPrimitiveComponentTransfer *upself;

   upself = (RsvgFilterPrimitiveComponentTransfer*) self;
   g_string_free (upself->super.result, TRUE);
   g_string_free (upself->super.in, TRUE);
   _rsvg_node_free (self);
}

RsvgNode *
rsvg_new_filter_primitive_component_transfer (void)
{
   RsvgFilterPrimitiveComponentTransfer *filter;

   filter = g_new (RsvgFilterPrimitiveComponentTransfer, 1);
   _rsvg_node_init (&filter->super.super, RSVG_NODE_TYPE_FILTER_PRIMITIVE_COMPONENT_TRANSFER);
   filter->super.result = g_string_new ("none");
   filter->super.in = g_string_new ("none");
   filter->super.x.factor = filter->super.y.factor = filter->super.width.factor =
       filter->super.height.factor = 'n';
   filter->super.render = &rsvg_filter_primitive_component_transfer_render;
   filter->super.super.free = &rsvg_filter_primitive_component_transfer_free;
   filter->super.super.set_atts = rsvg_filter_primitive_component_transfer_set_atts;
   return (RsvgNode *) filter;
}
Comment 1 Ron Hopper 2016-02-08 21:27:39 UTC
Created attachment 320657 [details] [review]
patch to add destructor
Comment 2 André Klapper 2016-03-08 23:28:41 UTC
Could this simple patch get a review?
Comment 3 Federico Mena Quintero 2016-03-31 01:51:51 UTC
Good catch, thanks!

I've pushed this as commit 76ad48b8210168869cedb1419b1e49dcf2e064a1.  It should appear in librsvg 2.40.14.