[sr-dev] git:5.5:abbe78ae: core: clone value for loadmodulex

Daniel-Constantin Mierla miconda at gmail.com
Tue Jun 29 14:53:29 CEST 2021


Module: kamailio
Branch: 5.5
Commit: abbe78aec28d46b74f59d14334b6e4871915ea4a
URL: https://github.com/kamailio/kamailio/commit/abbe78aec28d46b74f59d14334b6e4871915ea4a

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-29T14:42:35+02:00

core: clone value for loadmodulex

(cherry picked from commit e04890fe90d6e5ce879f968eb689e8616b318d54)

---

Modified: src/core/sr_module.c

---

Diff:  https://github.com/kamailio/kamailio/commit/abbe78aec28d46b74f59d14334b6e4871915ea4a.diff
Patch: https://github.com/kamailio/kamailio/commit/abbe78aec28d46b74f59d14334b6e4871915ea4a.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