[CDRIVER-2194] Memory leaks in mongoc-cluster.c Created: 20/Jun/17 Updated: 22/Jun/17 Resolved: 22/Jun/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | 1.6.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Rafael de Lucena Valle | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | Bug, driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
libmongoc 1.6.3 |
||
| Attachments: |
|
| Description |
|
Using a custom version of collectd (based on 5.4.3) with libmongoc-1.6.3, I found some memory leaks and some of them are in the libmongoc, specially on: From mongoc-cluster.c
|
| Comments |
| Comment by A. Jesse Jiryu Davis [ 22/Jun/17 ] | ||||||||||||||||||
|
I've manually inspected the first few code paths, and it seems like memleax is giving you false positives. It thinks all the server_description_t pointers passed to mongoc_server_stream_new() are leaked, when in fact they are freed in mongoc_server_stream_cleanup(). It also thinks the bson_t "cmd" that grows to fit demand in _mongoc_write_command() is leaked, but that function always calls bson_destroy (&cmd) before exiting. | ||||||||||||||||||
| Comment by Rafael de Lucena Valle [ 21/Jun/17 ] | ||||||||||||||||||
|
Looking with more time at the code, I think this can be a false positive because of behavior of memleax tool.
If it is, sorry about the misleading issue. | ||||||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 20/Jun/17 ] | ||||||||||||||||||
|
Interesting, thanks. I wonder why we haven't caught the same errors in Coverity or valgrind? We'll take a look. | ||||||||||||||||||
| Comment by Rafael de Lucena Valle [ 20/Jun/17 ] | ||||||||||||||||||
|
Sorry about the title, can I edit this? Best regards |