mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-07 18:38:02 +00:00
Merged revisions 165318 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r165318 | mmichelson | 2008-12-17 15:17:20 -0600 (Wed, 17 Dec 2008) | 15 lines Merged revisions 165255 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r165255 | mmichelson | 2008-12-17 14:51:38 -0600 (Wed, 17 Dec 2008) | 7 lines Fix some memory leaks found while looking at how realtime configs are handled. Also cleaned up some coding guidelines violations in app_realtime.c, mostly related to spacing ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@165322 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -496,6 +496,9 @@ static struct ast_config *realtime_directory(char *context)
|
|||||||
if (!cat) {
|
if (!cat) {
|
||||||
ast_log(LOG_WARNING, "Out of memory\n");
|
ast_log(LOG_WARNING, "Out of memory\n");
|
||||||
ast_config_destroy(cfg);
|
ast_config_destroy(cfg);
|
||||||
|
if (rtdata) {
|
||||||
|
ast_config_destroy(rtdata);
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ast_category_append(cfg, cat);
|
ast_category_append(cfg, cat);
|
||||||
|
|||||||
@@ -2004,8 +2004,12 @@ static void leave_queue(struct queue_ent *qe)
|
|||||||
|
|
||||||
/*If the queue is a realtime queue, check to see if it's still defined in real time*/
|
/*If the queue is a realtime queue, check to see if it's still defined in real time*/
|
||||||
if (q->realtime) {
|
if (q->realtime) {
|
||||||
if (!ast_load_realtime("queues", "name", q->name, NULL))
|
struct ast_variable *var;
|
||||||
|
if (!(var = ast_load_realtime("queues", "name", q->name, NULL))) {
|
||||||
q->dead = 1;
|
q->dead = 1;
|
||||||
|
} else {
|
||||||
|
ast_variables_destroy(var);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q->dead) {
|
if (q->dead) {
|
||||||
|
|||||||
@@ -8465,6 +8465,8 @@ static char *show_users_realtime(int fd, const char *context)
|
|||||||
"=============================================================\n"
|
"=============================================================\n"
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
|
ast_config_destroy(cfg);
|
||||||
|
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
static char *cli_realtime_load(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *cli_realtime_load(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
#define CRL_HEADER_FORMAT "%30s %-30s\n"
|
#define CRL_HEADER_FORMAT "%30s %-30s\n"
|
||||||
struct ast_variable *var=NULL;
|
struct ast_variable *var = NULL, *orig_var = NULL;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CLI_INIT:
|
case CLI_INIT:
|
||||||
@@ -66,6 +66,7 @@ static char *cli_realtime_load(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
|||||||
if (var) {
|
if (var) {
|
||||||
ast_cli(a->fd, CRL_HEADER_FORMAT, "Column Name", "Column Value");
|
ast_cli(a->fd, CRL_HEADER_FORMAT, "Column Name", "Column Value");
|
||||||
ast_cli(a->fd, CRL_HEADER_FORMAT, "--------------------", "--------------------");
|
ast_cli(a->fd, CRL_HEADER_FORMAT, "--------------------", "--------------------");
|
||||||
|
orig_var = var;
|
||||||
while (var) {
|
while (var) {
|
||||||
ast_cli(a->fd, CRL_HEADER_FORMAT, var->name, var->value);
|
ast_cli(a->fd, CRL_HEADER_FORMAT, var->name, var->value);
|
||||||
var = var->next;
|
var = var->next;
|
||||||
@@ -73,6 +74,7 @@ static char *cli_realtime_load(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
|||||||
} else {
|
} else {
|
||||||
ast_cli(a->fd, "No rows found matching search criteria.\n");
|
ast_cli(a->fd, "No rows found matching search criteria.\n");
|
||||||
}
|
}
|
||||||
|
ast_variables_destroy(orig_var);
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user