security_events: Fix error caused by DTD validation error
[asterisk/asterisk.git] / res / ael / pval.c
index 8dd1f7c..70bd689 100644 (file)
  * 
  */
 
+/*** MODULEINFO
+       <support_level>extended</support_level>
+ ***/
+
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
@@ -1160,7 +1164,11 @@ static pval *get_goto_target(pval *item)
        pval *curr_ext = get_extension_or_contxt(item); /* containing exten, or macro */
        pval *curr_cont;
        
-       if (item->u1.list && !item->u1.list->next && !strstr((item->u1.list)->u1.str,"${")) {
+       if (!item->u1.list) {
+               return NULL;
+       }
+
+       if (!item->u1.list->next && !strstr((item->u1.list)->u1.str,"${")) {
                struct pval *x = find_label_in_current_extension((char*)((item->u1.list)->u1.str), curr_ext);
                        return x;
        }
@@ -1219,21 +1227,24 @@ static pval *get_goto_target(pval *item)
                        return x;
                }
        }
-       return 0;
+       return NULL;
 }
 
 static void check_goto(pval *item)
 {
+       if (!item->u1.list) {
+               return;
+       }
+
        /* check for the target of the goto-- does it exist? */
        if ( !(item->u1.list)->next && !(item->u1.list)->u1.str ) {
                ast_log(LOG_ERROR,"Error: file %s, line %d-%d: goto:  empty label reference found!\n",
                                item->filename, item->startline, item->endline);
                errs++;
        }
-       
+
        /* just one item-- the label should be in the current extension */
-       
-       if (item->u1.list && !item->u1.list->next && !strstr((item->u1.list)->u1.str,"${")) {
+       if (!item->u1.list->next && !strstr(item->u1.list->u1.str,"${")) {
                struct pval *z = get_extension_or_contxt(item);
                struct pval *x = 0;
                if (z)
@@ -2891,7 +2902,7 @@ void ael2_semantic_check(pval *item, int *arg_errs, int *arg_warns, int *arg_not
        if (!item)
                return; /* don't check an empty tree */
 #ifdef AAL_ARGCHECK
-       rfilename = alloca(10 + strlen(ast_config_AST_VAR_DIR));
+       rfilename = ast_alloca(10 + strlen(ast_config_AST_VAR_DIR));
        sprintf(rfilename, "%s/applist", ast_config_AST_VAR_DIR);
        
        apps = argdesc_parse(rfilename, &argapp_errs); /* giveth */
@@ -5882,7 +5893,7 @@ pval* pvalGlobalsWalkStatements( pval *p, pval **next_statement )
 {
        if (!pvalCheckType(p, "pvalGlobalsWalkStatements", PV_GLOBALS))
                return 0;
-       if (!next_statement) {
+       if (!*next_statement) {
                *next_statement = p;
                return p;
        } else {
@@ -5903,7 +5914,7 @@ void pvalTopLevAddObject( pval *p, pval *contextOrObj )
 
 pval *pvalTopLevWalkObjects(pval *p, pval **next_obj )
 {
-       if (!next_obj) {
+       if (!*next_obj) {
                *next_obj = p;
                return p;
        } else {