[sr-dev] git:master:7c9b5c8a: ndb_mongodb: fix initialization crash

Nuno Ferreira nferreira at fuze.com
Tue Apr 23 08:56:24 CEST 2019


Module: kamailio
Branch: master
Commit: 7c9b5c8ada2933086a7665bca4aaea016a394b1f
URL: https://github.com/kamailio/kamailio/commit/7c9b5c8ada2933086a7665bca4aaea016a394b1f

Author: Nuno Ferreira <nferreira at fuze.com>
Committer: Nuno Ferreira <nferreira at fuze.com>
Date: 2019-04-22T19:36:25+01:00

ndb_mongodb: fix initialization crash

- Initialize mongodb c driver before any other mongo api call.
  Without this, kamailio would crash with a segmentation fault.
  This probably won't happen if a module was also already
   being used with a db_mongodb setup.

---

Modified: src/modules/ndb_mongodb/mongodb_client.c

---

Diff:  https://github.com/kamailio/kamailio/commit/7c9b5c8ada2933086a7665bca4aaea016a394b1f.diff
Patch: https://github.com/kamailio/kamailio/commit/7c9b5c8ada2933086a7665bca4aaea016a394b1f.patch

---

diff --git a/src/modules/ndb_mongodb/mongodb_client.c b/src/modules/ndb_mongodb/mongodb_client.c
index 746c5876fd..b49f111998 100644
--- a/src/modules/ndb_mongodb/mongodb_client.c
+++ b/src/modules/ndb_mongodb/mongodb_client.c
@@ -53,6 +53,7 @@ int mongodbc_init(void)
 		return -1;
 	}
 
+	mongoc_init();
 	for(rsrv=_mongodbc_srv_list; rsrv; rsrv=rsrv->next)
 	{
 		if(rsrv->uri==NULL || rsrv->uri->len<=0) {




More information about the sr-dev mailing list