When the client calls libcouchbase_create and then later calls libcouchbase_destroy, some memory is leaked. For a client with many threads that open and close couchbase sessions, this will lead to memory exhaustion. The leak is caused by the use of strdup() in setup_boostrap_hosts(). These duplicated strings are not free'd in libcouchbase_destroy. The leak can be seen by using valgrind.
I have attached a proof of concept, and a patch with a proposed fix.
I have only tested on 1.0.2, but other versions may be affected.
|For Gerrit Dashboard: &For+CCBC-65=message:CCBC-65|
|16032,3||[CCBC-65] Memory leak in libcouchbase_create / libcouchbase_destroy||libcouchbase||Status: MERGED||+2||+1|
|16685,2||Merge branch 'release10'||libcouchbase||Status: MERGED||+2||+1|
|Field||Original Value||New Value|
|Status||Open [ 1 ]||Resolved [ 5 ]|
|Fix Version/s||1.0.4 [ 10327 ]|
|Resolution||Fixed [ 1 ]|
|Status||Resolved [ 5 ]||Closed [ 6 ]|
|Workflow||jira [ 17122 ]||Couchbase SDK Workflow [ 43728 ]|