Merge "astobj2: Reduce memory overhead."
[asterisk/asterisk.git] / main / astobj2.c
index ea4ad02..23109a6 100644 (file)
        <support_level>core</support_level>
  ***/
 
        <support_level>core</support_level>
  ***/
 
+/* This reduces the size of lock structures within astobj2 objects when
+ * DEBUG_THREADS is not defined. */
+#define DEBUG_THREADS_LOOSE_ABI
+
 #include "asterisk.h"
 
 #include "asterisk/_private.h"
 #include "asterisk.h"
 
 #include "asterisk/_private.h"
@@ -1194,8 +1198,11 @@ int astobj2_init(void)
                }
        }
 
                }
        }
 
+       ast_register_cleanup(astobj2_cleanup);
+
        if (container_init() != 0) {
                fclose(ref_log);
        if (container_init() != 0) {
                fclose(ref_log);
+               ref_log = NULL;
                return -1;
        }
 
                return -1;
        }
 
@@ -1203,7 +1210,5 @@ int astobj2_init(void)
        ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2));
 #endif /* defined(AO2_DEBUG) */
 
        ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2));
 #endif /* defined(AO2_DEBUG) */
 
-       ast_register_cleanup(astobj2_cleanup);
-
        return 0;
 }
        return 0;
 }