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 651436 - Possible memory leak in e_contact_name_from_string()
Possible memory leak in e_contact_name_from_string()
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Contacts
2.32.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-addressbook-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2011-05-30 07:49 UTC by Christophe Dumez
Modified: 2011-06-07 09:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (1.01 KB, patch)
2011-05-30 07:49 UTC, Christophe Dumez
accepted-commit_now Details | Review
Patch for master (1.01 KB, patch)
2011-06-06 13:56 UTC, Christophe Dumez
committed Details | Review

Description Christophe Dumez 2011-05-30 07:49:58 UTC
Created attachment 188861 [details] [review]
Proposed patch

The 'name' variable memory gets leaked when name_str is NULL. See attached patch.
Comment 1 Matthew Barnes 2011-05-31 13:38:06 UTC
Yep, that's valid.  In general, allocating memory in a function before checking arguments is a bug.

Commit to master and backport as far back as you need to.
Comment 2 Christophe Dumez 2011-06-06 13:56:30 UTC
Created attachment 189326 [details] [review]
Patch for master

Here is an adapted version of the patch that applied to master. The previous patch was meant for 2.32 and did not apply directly because of a formatting change in the code.
Comment 3 Patrick Ohly 2011-06-07 09:00:29 UTC
Chris backported the fixes and I committed them to 2.32 and 3.0 branches:

6cabbd8201ed15d656b4bf6568e56473e636bcae e_contact_name_from_string(): Fix possible memory leak
46db6a3212e60e3754f645e136bf0824438c047d e_contact_name_from_string(): Fix possible memory leak