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 660985 - memory leak in clutter_box_layout.c
memory leak in clutter_box_layout.c
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
1.8.x
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2011-10-05 13:11 UTC by Sunjin Yang
Modified: 2011-10-07 11:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix memory leak in clutter_box_layout.c (2.42 KB, patch)
2011-10-05 13:11 UTC, Sunjin Yang
needs-work Details | Review
Plug memory leaks in clutter_box_layout.c (git formatted patch) (2.69 KB, patch)
2011-10-07 06:24 UTC, Sunjin Yang
committed Details | Review

Description Sunjin Yang 2011-10-05 13:11:03 UTC
Created attachment 198336 [details] [review]
fix memory leak in clutter_box_layout.c

In Clutter version 1.8.0, there is memory leak in count_expand_children(), clutter_box_layout_allocate() in clutter-box-layout.c.

The children list from clutter_container_get_children() must be freed with g_list_free().
Comment 1 Emmanuele Bassi (:ebassi) 2011-10-06 12:53:38 UTC
Review of attachment 198336 [details] [review]:

thanks for catching this. for the next iteration, could you please use a git formatted patch? it makes it easier to handle attribution.

::: clutter-1.8.0.orig/clutter/clutter-box-layout.c
@@ +755,3 @@
   *visible_children = *expand_children = 0;
 
+  for (n_children = children = clutter_container_get_children (container);

I wouldn't use the double assignment; the common pattern to do this in Clutter, as well as other G* code, is:

  GList *children, *l;

  children = clutter_container_get_children (container);

  for (l = children; l != NULL; l = l->next)
    {
      ClutterActor *child = l->data;
    }

  g_list_free (children);
Comment 2 Sunjin Yang 2011-10-07 06:24:47 UTC
Created attachment 198508 [details] [review]
Plug memory leaks in clutter_box_layout.c (git formatted patch)
Comment 3 Emmanuele Bassi (:ebassi) 2011-10-07 10:52:39 UTC
Review of attachment 198508 [details] [review]:

looks good to me.
Comment 4 Emmanuele Bassi (:ebassi) 2011-10-07 11:13:40 UTC
attachment 198508 [details] [review] pushed to master