GNOME Bugzilla – Bug 651468
return_error_and_list: Possible memory leak
Last modified: 2011-10-10 09:05:28 UTC
Created attachment 188882 [details] [review] Proposed patch return_error_and_list currently frees the list elements if free_data is TRUE. However, it does not free the GList itself. This causes a memory leak because the caller (_e_book_backend_get_contact_list) does not free the list either. See attached patch. Alternatively, the list could be freed at the end of _e_book_backend_get_contact_list() but I felt it was cleaner to free it in return_error_and_list() since it is called from other places.
The return_error_and_list() function no longer exists in the master branch, and the patch does not apply to the gnome-3-0 branch. If you can provide a revised patch for gnome-3-0 I'll take another look.
I have just double-checked the gnome-3-0 branch and it seems this memory leak was already fixed there (the exact same way as in my patch). Someone apparently forgot to backport it to gnome-2-32 branch though. Could someone please apply the patch to gnome-2-32 branch only then?
Ignore my last comment, it was not fixed in gnome-3-0 branch (I had my patch applied...). I, however, did not have any problem applying my patch to gnome-3-0.
Created attachment 189310 [details] [review] Patch for gnome-3-0
You've right it's leaking, but the change is not complete. I see that this code is in use only for e_data_book_respond_get_contact_list(), and I cannot speak for any 3rd-party book backends, though from those inside eds are all fine but the google's not, as that is freeing the list itself. evolution-exchange would work fine with your change, but evolution-mapi may crash on double free, as it also frees the list itself. I know it's bad it's leaking, but I would rather not fix this in stable, because of this mess in handling.
Can this fix be considered for master then?
It's obsolete for master and 3.2.0, after EClient changes, where the memory management was cleared during those changes. See comment #1 :) I'm closing this bug.