Fix leak and remove extra \n

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10891 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene 2008-12-20 02:14:10 +00:00
parent 0f12bc31cc
commit 40760653a3
1 changed files with 16 additions and 13 deletions

View File

@ -240,17 +240,17 @@ static switch_status_t do_config()
switch_core_db_test_reactive(db, "select * from limit_data", NULL, limit_sql);
switch_core_db_test_reactive(db, "select * from db_data", NULL, db_sql);
switch_core_db_test_reactive(db, "select * from group_data", NULL, group_sql);
switch_core_db_exec(db, "create index if not exists ld_hostname on limit_data (hostname)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists ld_uuid on limit_data (uuid)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists ld_realm on limit_data (realm)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists ld_id on limit_data (id)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists dd_realm on db_data (realm)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists dd_data_key on db_data (data_key)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists gd_groupname on group_data (groupname)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists gd_url on group_data (url)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists ld_hostname on limit_data (hostname)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists ld_uuid on limit_data (uuid)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists ld_realm on limit_data (realm)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists ld_id on limit_data (id)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists dd_realm on db_data (realm)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists dd_data_key on db_data (data_key)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists gd_groupname on group_data (groupname)", NULL, NULL, NULL);
switch_core_db_exec(db, "create index if not exists gd_url on group_data (url)", NULL, NULL, NULL);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
@ -773,7 +773,7 @@ SWITCH_STANDARD_API(limit_usage_function)
if (argc < 2) {
stream->write_function(stream, "USAGE: limit_usage %s\n", LIMIT_USAGE_USAGE);
return SWITCH_STATUS_SUCCESS;
goto end;
}
@ -786,7 +786,10 @@ SWITCH_STANDARD_API(limit_usage_function)
limit_execute_sql_callback(NULL, sql, sql2str_callback, &cbt);
switch_safe_free(sql);
stream->write_function(stream, "%s\n", buf);
stream->write_function(stream, "%s", buf);
end:
switch_safe_free(mydata);
return SWITCH_STATUS_SUCCESS;
}