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 443514 - Incorrect freeing of SList of SLists
Incorrect freeing of SList of SLists
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator
0.0.x
Other All
: Low minor
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on: 443522
Blocks:
 
 
Reported: 2007-06-03 11:27 UTC by Michael Lawrence
Modified: 2008-10-25 05:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Lawrence 2007-06-03 11:27:28 UTC
Please describe the problem:
A function that uses a list of lists (SLists) of strings is trying to free the first list with g_slist_foreach(list, g_free) instead of g_slist_foreach(list, g_slist_free).

Steps to reproduce:
1. Write a method that creates a list of lists.
2. Compile the code
3. 


Actual results:
Incorrect g_slist_free invocation.

Expected results:
g_slist_foreach(list, g_slist_free)

Does this happen every time?
yes

Other information:
Comment 1 Jürg Billeter 2007-06-05 11:20:24 UTC
g_slist_foreach(list, g_slist_free) would also be incorrect as this wouldn't free the elements of the inner lists if that's necessary. This can only be fixed completely when bug 443522 has been fixed.
Comment 2 Jürg Billeter 2008-04-19 16:54:37 UTC
Lowering priority, I don't recommend you to use GList / GSList for anything more than simple lists, as they have quite some caveats. Multi-dimensional arrays might help in your case.
Comment 3 Jürg Billeter 2008-05-11 13:42:55 UTC
2008-05-11  Jürg Billeter  <j@bitron.ch>

	* gobject/valaccodegenerator.vala: fix freeing nested GLists and
	GSLists, fixes bug 443514

Fixed in r1369.
Comment 4 Marc-Andre Lureau 2008-10-18 23:42:42 UTC
test case added to vala-tests, still something wrong with memory.
reopening
Comment 5 Jürg Billeter 2008-10-25 05:52:18 UTC
The issue in the test case is not the freeing as described in this bug but the copying of the list. l.copy() returns a SList<weak string> right now, however, Vala accepts appending even though it should only accept SList<string>. Replacing l.copy() by #l fixes the test case. The test case should still be fixed, of course, but this bug can be closed again.