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 651466 - e_dbhash_new: Close and reopen db handle to avoid memory leak
e_dbhash_new: Close and reopen db handle to avoid memory leak
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 11:50 UTC by Christophe Dumez
Modified: 2011-06-07 09:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (1.21 KB, patch)
2011-05-30 11:50 UTC, Christophe Dumez
committed Details | Review

Description Christophe Dumez 2011-05-30 11:50:51 UTC
Created attachment 188878 [details] [review]
Proposed patch

According to the documentation [1], "If DB->open fails, the DB->close method should be called to discard the DB handle". The current code was calling open() again on the same handle without closing it it first, possibly causing memory leaks.
    
This patch is adapted from commit 37d3c0f65c989afe9ffc2d734d86b2ae0019edae in eds-fremantle GIT repository.

[1] http://www.cs.sunysb.edu/documentation/BerkeleyDB/api_c/db_open.html
Comment 1 Matthew Barnes 2011-05-31 14:43:35 UTC
Seems okay to me.  Commit to master and backport as needed.
Comment 2 Patrick Ohly 2011-06-07 09:01:13 UTC
Chris backported the fixes and I committed them to 2.32 and 3.0 branches:

c1152557704e691a527ab1f7243e9e2c798058fe e_dbhash_new: Close and reopen db handle to avoid memory leak
c422b7050e5d009d3679cddcce479f9dacfbc803 e_dbhash_new: Close and reopen db handle to avoid memory leak