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 323002 - items list leaked
items list leaked
Status: RESOLVED FIXED
Product: libegg
Classification: Other
Component: recent-files
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Emmanuele Bassi (:ebassi)
Libegg maintenance
Depends on:
Blocks:
 
 
Reported: 2005-12-02 09:56 UTC by Paolo Borelli
Modified: 2005-12-02 13:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.14 KB, patch)
2005-12-02 09:57 UTC, Paolo Borelli
none Details | Review
leak fix (4.36 KB, patch)
2005-12-02 12:58 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Paolo Borelli 2005-12-02 09:56:04 UTC
egg_recent_model_filter leaks the whole list of item since it does

while (list) {
    ...
    list = list->next;
}

g_list_free (list);

thus freeing NULL
Comment 1 Paolo Borelli 2005-12-02 09:57:30 UTC
Created attachment 55516 [details] [review]
patch

the patch is pretty simple, but only lightly tested
Comment 2 Emmanuele Bassi (:ebassi) 2005-12-02 12:45:46 UTC
I've found it yesterday evening, and was about to commit a patch this morning.
Yours is better, though, since it removes that damned while() too, so I'll
commit yours right away along with some code clean-ups.

Thanks.
Comment 3 Emmanuele Bassi (:ebassi) 2005-12-02 12:52:41 UTC
we still leak the filtered items: we need a egg_recent_item_unref() on the items
that got filtered out.
Comment 4 Emmanuele Bassi (:ebassi) 2005-12-02 12:58:01 UTC
Created attachment 55519 [details] [review]
leak fix

this fixes the leak and improves a bit the code readability
Comment 5 Emmanuele Bassi (:ebassi) 2005-12-02 13:06:59 UTC
2005-12-02  Emmanuele Bassi  <ebassi@cvs.gnome.org>
	
	* libegg/recent-files/egg-recent-model.c (parse_info_init),
	(parse_info_new), (end_element_handler): make ParseInfo a dynamically
	allocated struct instead of passing pointers around.

	* libegg/recent-files/egg-recent-model.c (egg_recent_model_filter):
	plug the leakage of the unfiltered item list, and clean up the code a
	bit (fixes bug #323002, based on a patch by Paolo Borelli).