Description
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.cindex 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 ();}#endifWhen embedding mongoc phongo should still compile with MONGOC_NO_AUTOMATIC_GLOBALS, but hopefully this patch can make standard mongoc shared build work
Attachments
Issue Links
- is related to
-
CDRIVER-592 Deprecate mongoc_init_ctor/dtor
-
- Closed
-
-
CDRIVER-1160 configure flag for MONGOC_NO_AUTOMATIC_GLOBALS
-
- Closed
-
-
PHPC-632 FPM segfaults during shutdown
-
- Closed
-