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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2018-03-03T07:39:45+01:00

core: check return of dlsym() before dlerror() handling

- cope with the case when dlerror is not reset by dlsym
- related to GH #1465

---

Modified: src/core/sr_module.c

---

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

---

diff --git a/src/core/sr_module.c b/src/core/sr_module.c
index 594f3d6af8..8a195fc12d 100644
--- a/src/core/sr_module.c
+++ b/src/core/sr_module.c
@@ -630,11 +630,14 @@ int load_module(char* mod_path)
                if(expref.len>3 && strcmp(expref.s+expref.len-3, ".so")==0)
                        expref.len -= 3;
                snprintf(exbuf, 62, "_%.*s_exports", expref.len, expref.s);
-               exp = (union module_exports_u*)dlsym(handle, exbuf);
                LM_DBG("looking up exports with name: %s\n", exbuf);
-               if ( (error =(char*)dlerror())!=0 ){
-                       LM_ERR("%s\n", error);
-                       goto error1;
+               exp = (union module_exports_u*)dlsym(handle, exbuf);
+               if(exp==NULL) {
+                       if ( (error =(char*)dlerror())!=0 ){
+                               LM_ERR("failure for exports symbol: %s - 
dlerror: %s\n",
+                                               exbuf, error);
+                               goto error1;
+                       }
                }
        }
        /* hack to allow for kamailio style dlflags inside exports */


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to