[sr-dev] git:master:e04890fe: core: clone value for loadmodulex

Daniel-Constantin Mierla miconda at gmail.com
Tue Jun 29 09:29:32 CEST 2021


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-29T09:25:30+02:00

core: clone value for loadmodulex

---

Modified: src/core/sr_module.c

---

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

---

diff --git a/src/core/sr_module.c b/src/core/sr_module.c
index 03f8feef81..b26fde218c 100644
--- a/src/core/sr_module.c
+++ b/src/core/sr_module.c
@@ -45,6 +45,7 @@
 #include "fmsg.h"
 #include "async_task.h"
 #include "shm_init.h"
+#include "str_list.h"
 #include "daemonize.h"
 
 #include <sys/stat.h>
@@ -57,6 +58,8 @@
 
 
 struct sr_module* modules=0;
+static str_list_t *_ksr_loadmod_strlist = NULL;
+
 
 /*We need to define this symbol on Solaris becuase libcurl relies on libnspr which looks for this symbol.
   If it is not defined, dynamic module loading (dlsym) fails */
@@ -656,6 +659,7 @@ int load_modulex(char* mod_path)
 	str sfmt;
 	sip_msg_t *fmsg;
 	char* emod;
+	str_list_t *sb;
 
 	emod = mod_path;
 	if(strchr(mod_path, '$') != NULL) {
@@ -663,7 +667,12 @@ int load_modulex(char* mod_path)
 		sfmt.s = mod_path;
 		sfmt.len = strlen(sfmt.s);
 		if(pv_eval_str(fmsg, &seval, &sfmt)>=0) {
-			emod = seval.s;
+			sb = str_list_block_add(&_ksr_loadmod_strlist, seval.s, seval.len);
+			if(sb==NULL) {
+				LM_ERR("failed to handle load module: %s\n", mod_path);
+				return -1;
+			}
+			emod = sb->s.s;
 		}
 	}
 




More information about the sr-dev mailing list