fix leak and remove duplicate safe_free
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13455 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
6befc571cc
commit
533cbaf7c5
|
@ -2062,12 +2062,13 @@ SWITCH_STANDARD_API(session_displace_function)
|
||||||
SWITCH_STANDARD_API(break_function)
|
SWITCH_STANDARD_API(break_function)
|
||||||
{
|
{
|
||||||
switch_core_session_t *psession = NULL;
|
switch_core_session_t *psession = NULL;
|
||||||
char *mycmd, *flag;
|
char *mycmd = NULL, *flag;
|
||||||
switch_channel_t *channel = NULL;
|
switch_channel_t *channel = NULL;
|
||||||
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
if (switch_strlen_zero(cmd)) {
|
if (switch_strlen_zero(cmd)) {
|
||||||
stream->write_function(stream, "-USAGE: %s\n", BREAK_SYNTAX);
|
stream->write_function(stream, "-USAGE: %s\n", BREAK_SYNTAX);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
mycmd = strdup(cmd);
|
mycmd = strdup(cmd);
|
||||||
|
@ -2079,7 +2080,7 @@ SWITCH_STANDARD_API(break_function)
|
||||||
|
|
||||||
if (!(psession = switch_core_session_locate(mycmd))) {
|
if (!(psession = switch_core_session_locate(mycmd))) {
|
||||||
stream->write_function(stream, "-ERR No Such Channel!\n");
|
stream->write_function(stream, "-ERR No Such Channel!\n");
|
||||||
return SWITCH_STATUS_SUCCESS;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag && !strcasecmp(flag, "all")) {
|
if (flag && !strcasecmp(flag, "all")) {
|
||||||
|
@ -2092,9 +2093,15 @@ SWITCH_STANDARD_API(break_function)
|
||||||
} else {
|
} else {
|
||||||
switch_channel_set_flag(channel, CF_BREAK);
|
switch_channel_set_flag(channel, CF_BREAK);
|
||||||
}
|
}
|
||||||
switch_core_session_rwunlock(psession);
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
done:
|
||||||
|
if (psession) {
|
||||||
|
switch_core_session_rwunlock(psession);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_safe_free(mycmd);
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PAUSE_SYNTAX "<uuid> <on|off>"
|
#define PAUSE_SYNTAX "<uuid> <on|off>"
|
||||||
|
@ -2340,8 +2347,6 @@ static void sch_api_callback(switch_scheduler_task_t *task)
|
||||||
if (api_task->recur) {
|
if (api_task->recur) {
|
||||||
task->runtime = switch_epoch_time_now(NULL) + api_task->recur;
|
task->runtime = switch_epoch_time_now(NULL) + api_task->recur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UNSCHED_SYNTAX "<task_id>"
|
#define UNSCHED_SYNTAX "<task_id>"
|
||||||
|
@ -2383,7 +2388,6 @@ SWITCH_STANDARD_API(sched_api_function)
|
||||||
if ((dcmd = strchr(group, ' '))) {
|
if ((dcmd = strchr(group, ' '))) {
|
||||||
*dcmd++ = '\0';
|
*dcmd++ = '\0';
|
||||||
|
|
||||||
|
|
||||||
if (*tm == '+') {
|
if (*tm == '+') {
|
||||||
when = switch_epoch_time_now(NULL) + atol(tm + 1);
|
when = switch_epoch_time_now(NULL) + atol(tm + 1);
|
||||||
} else if (*tm == '@') {
|
} else if (*tm == '@') {
|
||||||
|
@ -2432,8 +2436,9 @@ static void *SWITCH_THREAD_FUNC bgapi_exec(switch_thread_t *thread, void *obj)
|
||||||
char *arg;
|
char *arg;
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
|
|
||||||
if (!job)
|
if (!job) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
switch_thread_rwlock_rdlock(bgapi_rwlock);
|
switch_thread_rwlock_rdlock(bgapi_rwlock);
|
||||||
|
|
||||||
|
@ -2622,7 +2627,6 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||||
#define COMPLETE_SYNTAX "add <word>|del [<word>|*]"
|
#define COMPLETE_SYNTAX "add <word>|del [<word>|*]"
|
||||||
SWITCH_STANDARD_API(complete_function)
|
SWITCH_STANDARD_API(complete_function)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
|
|
||||||
if ((status = switch_console_set_complete(cmd)) == SWITCH_STATUS_SUCCESS) {
|
if ((status = switch_console_set_complete(cmd)) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
@ -2637,7 +2641,6 @@ SWITCH_STANDARD_API(complete_function)
|
||||||
#define ALIAS_SYNTAX "add <alias> <command> | del [<alias>|*]"
|
#define ALIAS_SYNTAX "add <alias> <command> | del [<alias>|*]"
|
||||||
SWITCH_STANDARD_API(alias_function)
|
SWITCH_STANDARD_API(alias_function)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
|
|
||||||
if ((status = switch_console_set_alias(cmd)) == SWITCH_STATUS_SUCCESS) {
|
if ((status = switch_console_set_alias(cmd)) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
@ -2958,7 +2961,6 @@ SWITCH_STANDARD_API(uuid_session_heartbeat_function)
|
||||||
switch_safe_free(mycmd);
|
switch_safe_free(mycmd);
|
||||||
stream->write_function(stream, "-ERR Usage: uuid_session_heartbeat %s", HEARTBEAT_SYNTAX);
|
stream->write_function(stream, "-ERR Usage: uuid_session_heartbeat %s", HEARTBEAT_SYNTAX);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_STANDARD_API(uuid_flush_dtmf_function)
|
SWITCH_STANDARD_API(uuid_flush_dtmf_function)
|
||||||
|
@ -3156,7 +3158,6 @@ SWITCH_STANDARD_API(uuid_send_dtmf_function)
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
stream->write_function(stream, "-USAGE: %s\n", UUID_SEND_DTMF_SYNTAX);
|
stream->write_function(stream, "-USAGE: %s\n", UUID_SEND_DTMF_SYNTAX);
|
||||||
switch_safe_free(mycmd);
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (psession) {
|
if (psession) {
|
||||||
|
@ -3263,7 +3264,6 @@ SWITCH_STANDARD_API(global_setvar_function)
|
||||||
#define GLOBAL_GETVAR_SYNTAX "<var>"
|
#define GLOBAL_GETVAR_SYNTAX "<var>"
|
||||||
SWITCH_STANDARD_API(global_getvar_function)
|
SWITCH_STANDARD_API(global_getvar_function)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (switch_strlen_zero(cmd)) {
|
if (switch_strlen_zero(cmd)) {
|
||||||
switch_core_dump_variables(stream);
|
switch_core_dump_variables(stream);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3353,7 +3353,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
|
|
||||||
for (x = 30; x > 0; x--) {
|
for (x = 30; x > 0; x--) {
|
||||||
if (switch_thread_rwlock_trywrlock(bgapi_rwlock) == SWITCH_STATUS_SUCCESS) {
|
if (switch_thread_rwlock_trywrlock(bgapi_rwlock) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_thread_rwlock_unlock(bgapi_rwlock);
|
switch_thread_rwlock_unlock(bgapi_rwlock);
|
||||||
|
@ -3372,7 +3371,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||||
{
|
{
|
||||||
switch_api_interface_t *commands_api_interface;
|
switch_api_interface_t *commands_api_interface;
|
||||||
|
|
Loading…
Reference in New Issue