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 664069 - gvariant: Never break out of g_variant_iter_loop
gvariant: Never break out of g_variant_iter_loop
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gvariant
unspecified
Other All
: Normal normal
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-11-14 20:39 UTC by Stef Walter
Modified: 2012-01-02 17:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gvariant: Never break out of g_variant_iter_loop (1.34 KB, patch)
2011-11-14 20:39 UTC, Stef Walter
needs-work Details | Review
Updated patch. Okay to commit? (1.34 KB, patch)
2012-01-02 12:59 UTC, Stef Walter
accepted-commit_now Details | Review

Description Stef Walter 2011-11-14 20:39:13 UTC
If you break out of a g_variant_iter_loop you get a leak.
Document this.
Comment 1 Stef Walter 2011-11-14 20:39:16 UTC
Created attachment 201399 [details] [review]
gvariant: Never break out of g_variant_iter_loop

 * Document how you should not break out of g_variant_iter_loop
   style loops.
Comment 2 Allison Karlitskaya (desrt) 2011-11-15 14:26:05 UTC
Review of attachment 201399 [details] [review]:

::: glib/gvariant.c
@@ +4794,3 @@
  * be freed, as appropriate.
  *
+ * You must repeatedly to call g_variant_iter_loop until %FALSE is returned.

EGRAMMAR

@@ +4826,3 @@
  *
  *         /<!-- -->* no need to free 'key' and 'value' here *<!-- -->/
+ *         /<!-- -->* unless breaking out of this loop *<!-- -->/

this conflicts with your stronger statement above which suggests that breaking is completely invalid.
Comment 3 Stef Walter 2012-01-02 12:59:06 UTC
Created attachment 204447 [details] [review]
Updated patch. Okay to commit?

gvariant: Never break out of g_variant_iter_loop

* Document how to break out of g_variant_iter_loop style loops.
Comment 4 Stef Walter 2012-01-02 17:34:51 UTC
Thanks. Committed.