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 771289 - Memory leaks in test-contact-types.c
Memory leaks in test-contact-types.c
Product: evolution-data-server
Classification: Platform
Component: general
3.21.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Reported: 2016-09-12 12:01 UTC by Tobias Mueller
Modified: 2017-01-20 14:03 UTC
See Also:
GNOME target: ---
GNOME version: ---

patch (1.09 KB, patch)
2016-09-12 12:01 UTC, Tobias Mueller
rejected Details | Review

Description Tobias Mueller 2016-09-12 12:01:11 UTC
Created attachment 335360 [details] [review]

Comment 1 Milan Crha 2016-09-19 12:32:23 UTC
Review of attachment 335360 [details] [review]:

Thanks for a bug report and patch, but:
a) the g_autofree doesn't guarantee the variable to be freed (it's not portable)
b) you did not initialize the variables, which is a requirement for using g_autofree
c) the structures are not meant to be freed by g_free(), but by e_contact_photo_free()

It also means that you caused a memory leak of the internal structure members, which is also the 'data' variable returned by g_base64_decode().

Do not use g_autofree and make it explicit what is freed, where it's freed and how it's freed. It makes code better, than hiding things under some not-everywhere supported compiler toys.
Comment 2 Milan Crha 2017-01-20 14:03:19 UTC
I found out that there had been more memory leaks than this one, thus I fixed them all (according to valgrind).

Created commit 3d136bd in eds master (3.23.90+)