Skip to content

Commit

Permalink
core: check return of dlsym() before dlerror() handling
Browse files Browse the repository at this point in the history
- cope with the case when dlerror is not reset by dlsym
- related to GH #1465

(cherry picked from commit 045d447)
(cherry picked from commit 289eb37)
  • Loading branch information
miconda committed Apr 25, 2018
1 parent c1a57ed commit 794292b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/core/sr_module.c
Expand Up @@ -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 */
Expand Down

0 comments on commit 794292b

Please sign in to comment.