Add missing checks during startup.

This ensures startup is canceled due to allocation failures from the
following initializations.
* channel.c: ast_channels_init
* config_options.c: aco_init

ASTERISK-26265 #close

Change-Id: I911ed08fa2a3be35de55903e0225957bcdbe9611
changes/11/3411/1
Corey Farrell 9 years ago
parent 9dc8cfabd5
commit 805f105f88

@ -29,7 +29,7 @@ void logger_queue_start(void); /*!< Provided by logger.c */
void clean_time_zones(void); /*!< Provided by localtime.c */
int ast_term_init(void); /*!< Provided by term.c */
int astdb_init(void); /*!< Provided by db.c */
void ast_channels_init(void); /*!< Provided by channel.c */
int ast_channels_init(void); /*!< Provided by channel.c */
void ast_builtins_init(void); /*!< Provided by cli.c */
int ast_cli_perms_init(int reload); /*!< Provided by cli.c */
int dnsmgr_init(void); /*!< Provided by dnsmgr.c */

@ -4504,7 +4504,10 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
exit(1);
}
aco_init();
if (aco_init()) {
printf("Failed: aco_init\n%s", term_quit());
exit(1);
}
if (ast_bucket_init()) {
printf("Failed: ast_bucket_init\n%s", term_quit());
@ -4598,7 +4601,10 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
exit(1);
}
ast_channels_init();
if (ast_channels_init()) {
printf("Failed: ast_channels_init\n%s", term_quit());
exit(1);
}
if (ast_endpoint_init()) {
printf ("Failed: ast_endpoint_init\n%s", term_quit());

@ -7803,13 +7803,14 @@ static void channels_shutdown(void)
ast_channel_unregister(&surrogate_tech);
}
void ast_channels_init(void)
int ast_channels_init(void)
{
channels = ao2_container_alloc(NUM_CHANNEL_BUCKETS,
ast_channel_hash_cb, ast_channel_cmp_cb);
if (channels) {
ao2_container_register("channels", channels, prnt_channel_key);
if (!channels) {
return -1;
}
ao2_container_register("channels", channels, prnt_channel_key);
ast_channel_register(&surrogate_tech);
@ -7823,6 +7824,7 @@ void ast_channels_init(void)
ast_register_cleanup(channels_shutdown);
return 0;
}
/*! \brief Print call group and pickup group ---*/

Loading…
Cancel
Save