[CDRIVER-148] Memory leak using write_concern Created: 07/Jun/12 Updated: 08/May/17 Resolved: 29/Jun/12 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | 0.6 |
| Fix Version/s: | 0.7 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | marcos grillo | Assignee: | Gary Murakami |
| Resolution: | Done | Votes: | 0 |
| Labels: | leak, writeconcern | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
fedora Linux 2.6.35.13-92.fc14.i686.PAE #1 SMP i686 i686 i386 GNU/Linux |
||
| Attachments: |
|
| Description |
|
If you use the mongo_set_write_concern function it internally leaks the response bson of the mongo_check_last_error function. Attched there is some code that reproduces this and a valgrind trace with the leak. |
| Comments |
| Comment by marcos grillo [ 29/Jun/12 ] |
|
Thank you for the fix |
| Comment by Gary Murakami [ 29/Jun/12 ] |
|
Marcos, many thanks for your input. I hope that you like the fixes. |
| Comment by auto [ 29/Jun/12 ] |
|
Author: {u'date': u'2012-06-28T20:49:16-07:00', u'email': u'gary.murakami@10gen.com', u'name': u'Gary Murakami'}Message: |
| Comment by marcos grillo [ 28/Jun/12 ] |
|
I've added a patch for this, please take a look at it |
| Comment by Gary Murakami [ 28/Jun/12 ] |
|
As you can guess, this is fairly serious as mongo_check_last_error is used frequently. |
| Comment by Gary Murakami [ 28/Jun/12 ] |
|
I also ran across this, thanks to valgrind - mongo_check_last_error calls mongo_find_one which allocates memory for the BSON "response", and bson_destroy is not called on "response", thus leaking memory. We should run valgrind on EVERYTHING! |