diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-12-26 05:20:08 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-12-26 05:20:08 +0000 |
commit | b93b1355dc5499cf649c62a6d9695271ed342a14 (patch) | |
tree | 5b7137f8995c96e861a7cf51d353084287a92931 /apps/app_meetme.c | |
parent | cb366eccb630d34261b3e2d455470c30d24fa9c6 (diff) |
Get rid of a needless memory allocation and only create a conference structure in find_conf_realtime if data was read from realtime. (issue #8669 reported by robl)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@48966 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_meetme.c')
-rw-r--r-- | apps/app_meetme.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 5bde2e18d..7a79fca53 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -1961,25 +1961,21 @@ static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char if (!strcmp(confno, cnf->confno)) break; } - if (cnf){ + if (cnf) { cnf->refcount += refcount; } AST_LIST_UNLOCK(&confs); if (!cnf) { char *pin = NULL, *pinadmin = NULL; /* For temp use */ + + var = ast_load_realtime("meetme", "confno", confno, NULL); - cnf = ast_calloc(1, sizeof(struct ast_conference)); - if (!cnf) { - ast_log(LOG_ERROR, "Out of memory\n"); + if (!var) return NULL; - } - var = ast_load_realtime("meetme", "confno", confno, NULL); while (var) { - if (!strcasecmp(var->name, "confno")) { - ast_copy_string(cnf->confno, var->value, sizeof(cnf->confno)); - } else if (!strcasecmp(var->name, "pin")) { + if (!strcasecmp(var->name, "pin")) { pin = ast_strdupa(var->value); } else if (!strcasecmp(var->name, "adminpin")) { pinadmin = ast_strdupa(var->value); @@ -1987,7 +1983,7 @@ static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char var = var->next; } ast_variables_destroy(var); - + cnf = build_conf(confno, pin ? pin : "", pinadmin ? pinadmin : "", make, dynamic, refcount); } |