]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix unload
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 24 May 2007 15:30:31 +0000 (15:30 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 24 May 2007 15:30:31 +0000 (15:30 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5213 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_loadable_module.c

index c9ec086efeff516c575c3f0a4d9b640adea65bcd..a95da577b2fe059b335adfbde8da9abe808aa145 100644 (file)
@@ -785,7 +785,6 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, ch
 
 SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir, char *fname, const char **err)
 {
-       switch_size_t len = 0;
        char *path = NULL;
        char *file = NULL;
        switch_loadable_module_t *module = NULL;
@@ -808,17 +807,9 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir,
                path = strdup(file);
        } else {
                if (strchr(file, '.')) {
-                       len = strlen(dir);
-                       len += strlen(file);
-                       len += 4;
-                       path = (char *) switch_core_alloc(loadable_modules.pool, len);
-                       snprintf(path, len, "%s%s%s", dir, SWITCH_PATH_SEPARATOR, file);
+                       path = switch_mprintf("%s%s%s", dir, SWITCH_PATH_SEPARATOR, file);
                } else {
-                       len = strlen(dir);
-                       len += strlen(file);
-                       len += 8;
-                       path = (char *) malloc(len);
-                       snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
+                       path = switch_mprintf("%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
                }
        }
 
@@ -833,6 +824,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir,
                        do_shutdown(module);
                }
        } else {
+               *err = "No such module!";
                status = SWITCH_STATUS_FALSE;
        }
        switch_mutex_unlock(loadable_modules.mutex);