[asterisk-commits] file: branch 1.4 r48966 - /branches/1.4/apps/app_meetme.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Dec 25 22:20:08 MST 2006


Author: file
Date: Mon Dec 25 23:20:08 2006
New Revision: 48966

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48966
Log:
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)

Modified:
    branches/1.4/apps/app_meetme.c

Modified: branches/1.4/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_meetme.c?view=diff&rev=48966&r1=48965&r2=48966
==============================================================================
--- branches/1.4/apps/app_meetme.c (original)
+++ branches/1.4/apps/app_meetme.c Mon Dec 25 23:20:08 2006
@@ -1961,25 +1961,21 @@
 		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 */
-
-		cnf = ast_calloc(1, sizeof(struct ast_conference));
-		if (!cnf) {
-			ast_log(LOG_ERROR, "Out of memory\n");
+		
+		var = ast_load_realtime("meetme", "confno", confno, NULL);
+
+		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 @@
 			var = var->next;
 		}
 		ast_variables_destroy(var);
-
+		
 		cnf = build_conf(confno, pin ? pin : "", pinadmin ? pinadmin : "", make, dynamic, refcount);
 	}
 



More information about the asterisk-commits mailing list