Merge "Astobj2: Fix initialization order of refdebug and AO2_DEBUG."
authorMatt Jordan <mjordan@digium.com>
Sat, 2 May 2015 15:17:31 +0000 (10:17 -0500)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Sat, 2 May 2015 15:17:31 +0000 (10:17 -0500)
main/asterisk.c
main/astobj2.c

index 86a190b..277604b 100644 (file)
@@ -4260,7 +4260,10 @@ int main(int argc, char *argv[])
        register_config_cli();
        read_config_maps();
 
-       astobj2_init();
+       if (astobj2_init()) {
+               printf("Failed: astobj2_init\n%s", term_quit());
+               exit(1);
+       }
 
        if (ast_opt_console) {
                if (el_hist == NULL || el == NULL)
index f9dd8d4..1db2dd4 100644 (file)
@@ -1143,10 +1143,6 @@ int astobj2_init(void)
 {
        char ref_filename[1024];
 
-       if (container_init() != 0) {
-               return -1;
-       }
-
        if (ast_opt_ref_debug) {
                snprintf(ref_filename, sizeof(ref_filename), "%s/refs", ast_config_AST_LOG_DIR);
                ref_log = fopen(ref_filename, "w");
@@ -1155,6 +1151,11 @@ int astobj2_init(void)
                }
        }
 
+       if (container_init() != 0) {
+               fclose(ref_log);
+               return -1;
+       }
+
 #if defined(AO2_DEBUG)
        ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2));
 #endif /* defined(AO2_DEBUG) */