Module: kamailio Branch: master Commit: 4752ad434c087ac3b11968e5241c61e9e1f903aa URL: https://github.com/kamailio/kamailio/commit/4752ad434c087ac3b11968e5241c61e9...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-05-17T08:08:20+02:00
secsipid: clod dlopen handle on mod destroy
---
Modified: src/modules/secsipid/secsipid_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/4752ad434c087ac3b11968e5241c61e9... Patch: https://github.com/kamailio/kamailio/commit/4752ad434c087ac3b11968e5241c61e9...
---
diff --git a/src/modules/secsipid/secsipid_mod.c b/src/modules/secsipid/secsipid_mod.c index 7553e8ede7..30357a235e 100644 --- a/src/modules/secsipid/secsipid_mod.c +++ b/src/modules/secsipid/secsipid_mod.c @@ -38,6 +38,8 @@
MODULE_VERSION
+static void *_secsipid_dlhandle = NULL; + static int secsipid_expire = 300; static int secsipid_timeout = 5;
@@ -107,6 +109,10 @@ struct module_exports exports = { */ static int mod_init(void) { + if(_secsipid_dlhandle!=0) { + dlclose(_secsipid_dlhandle); + _secsipid_dlhandle = NULL; + } return 0; }
@@ -115,7 +121,6 @@ static int mod_init(void) */ static int child_init(int rank) { - void *handle = NULL; char *errstr = NULL; char *modpath = NULL; secsipid_proc_bind_f bind_f = NULL; @@ -135,16 +140,16 @@ static int child_init(int rank) /* for openbsd */ #define RTLD_NOW DL_LAZY #endif - handle = dlopen(modpath, RTLD_NOW); /* resolve all symbols now */ - if (handle==0) { + _secsipid_dlhandle = dlopen(modpath, RTLD_NOW); /* resolve all symbols now */ + if (_secsipid_dlhandle==0) { LM_ERR("could not open module <%s>: %s\n", modpath, dlerror()); goto error; } /* launch register */ - bind_f = (secsipid_proc_bind_f)dlsym(handle, "secsipid_proc_bind"); + bind_f = (secsipid_proc_bind_f)dlsym(_secsipid_dlhandle, "secsipid_proc_bind"); if (((errstr=(char*)dlerror())==NULL) && bind_f!=NULL) { /* version control */ - if (!ksr_version_control(handle, modpath)) { + if (!ksr_version_control(_secsipid_dlhandle, modpath)) { goto error; } /* no error - call it */