jeroen / mongolite

Fast and Simple MongoDB Client for R
https://jeroen.github.io/mongolite/
286 stars 65 forks source link

Avoid memory leak within `R_mongo_get_default_database` #159

Closed MartinNowack closed 5 years ago

MartinNowack commented 5 years ago

According to https://s3.amazonaws.com/mciuploads/mongo-c-driver/docs/latest/mongoc_client_get_default_database.html allocated memory needs to be cleaned-up with mongoc_database_destroy.

Adds the proper call to avoid a memory leak.

jeroen commented 5 years ago

Thanks! There is no need to PROTECT() here because there are no R API calls between your protect and unprotect that could potentially trigger the gc. Can you remove that?

MartinNowack commented 5 years ago

@jeroen Sure no problem. Removed PROTECT().