[asterisk-commits] trunk r23480 - /trunk/pbx/pbx_dundi.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Apr 29 22:02:08 MST 2006


Author: russell
Date: Sun Apr 30 00:02:07 2006
New Revision: 23480

URL: http://svn.digium.com/view/asterisk?rev=23480&view=rev
Log:
handle a memory allocation failure immediately so the following large block
does not have to be indented

Modified:
    trunk/pbx/pbx_dundi.c

Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?rev=23480&r1=23479&r2=23480&view=diff
==============================================================================
--- trunk/pbx/pbx_dundi.c (original)
+++ trunk/pbx/pbx_dundi.c Sun Apr 30 00:02:07 2006
@@ -3995,13 +3995,11 @@
 				break;
 		}
 		if (!map) {
-			map = ast_calloc(1, sizeof(*map));
-			if (map) {
-				AST_LIST_INSERT_HEAD(&mappings, map, list);
-				map->dead = 1;
-			}
-		}
-		if (map) {
+			if (!(map = ast_calloc(1, sizeof(*map))))
+				return;
+			AST_LIST_INSERT_HEAD(&mappings, map, list);
+			map->dead = 1;
+		}
 			map->options = 0;
 			memset(fields, 0, sizeof(fields));
 			x = 0;
@@ -4046,7 +4044,6 @@
 				}
 			} else 
 				ast_log(LOG_WARNING, "Expected at least %d arguments in map, but got only %d\n", 4, x);
-		}
 	}
 }
 



More information about the asterisk-commits mailing list