|
Restoring the BSON memory allocation vtable in _mongoc_init_dtor() (before cleanup is invoked) will ensure that any resources allocated during the ctor are freed appropriately. This will resolve PHPC-632 for those using the PHP driver with a system install of libmongoc.
Per bjori's comment in CDRIVER-1160:
diff --git a/src/mongoc/mongoc-init.c b/src/mongoc/mongoc-init.c
|
index aee1f6e..c2e421d 100644
|
--- a/src/mongoc/mongoc-init.c
|
+++ b/src/mongoc/mongoc-init.c
|
@@ -171,6 +171,7 @@ static void _mongoc_init_dtor (void) __attribute__((destructor));
|
static void
|
_mongoc_init_dtor (void)
|
{
|
+ bson_mem_restore_vtable ();
|
mongoc_cleanup ();
|
}
|
#endif
|
When embedding mongoc phongo should still compile with MONGOC_NO_AUTOMATIC_GLOBALS, but hopefully this patch can make standard mongoc shared build work
|