@@ -2081,7 +2081,8 @@ static int load_config(void)
2081
2081
if (invalid_telenumeric_id (var -> value , 0 )) {
2082
2082
ast_log (LOG_ERROR , "Invalid sensor ID '%s' (must contain only 0-9 and A-D)\n" , var -> value );
2083
2083
ast_free (s );
2084
- goto nextsensor ;
2084
+ s = NULL ;
2085
+ break ;
2085
2086
}
2086
2087
ast_copy_string (s -> sensor_id , var -> value , sizeof (s -> sensor_id ));
2087
2088
} else if (!strcasecmp (var -> name , "disarm_delay" ) && !ast_strlen_zero (var -> value )) {
@@ -2090,14 +2091,17 @@ static int load_config(void)
2090
2091
ast_log (LOG_WARNING , "Unknown keyword in section '%s': %s at line %d of %s\n" , cat , var -> name , var -> lineno , CONFIG_FILE );
2091
2092
}
2092
2093
}
2093
- if (ast_strlen_zero (s -> sensor_id )) {
2094
- ast_log (LOG_ERROR , "Sensor '%s' missing sensor ID\n" , cat );
2095
- ast_free (s );
2096
- return -1 ;
2094
+ /* Using a label after this block triggers warnings in old versions of gcc about label at end of compound statement,
2095
+ * so just check the pointer: */
2096
+ if (s ) {
2097
+ if (ast_strlen_zero (s -> sensor_id )) {
2098
+ ast_log (LOG_ERROR , "Sensor '%s' missing sensor ID\n" , cat );
2099
+ ast_free (s );
2100
+ return -1 ;
2101
+ }
2102
+ ast_debug (4 , "Initializing alarm sensor %s\n" , s -> sensor_id );
2103
+ AST_RWLIST_INSERT_TAIL (& c -> sensors , s , entry );
2097
2104
}
2098
- ast_debug (4 , "Initializing alarm sensor %s\n" , s -> sensor_id );
2099
- AST_RWLIST_INSERT_TAIL (& c -> sensors , s , entry );
2100
- nextsensor :
2101
2105
} else if (!strcasecmp (type , "keypad" )) {
2102
2106
struct alarm_client * c ;
2103
2107
const char * client = ast_variable_retrieve (cfg , cat , "client" );
0 commit comments