Index: main/astobj2.c =================================================================== --- main/astobj2.c (revision 398366) +++ main/astobj2.c (working copy) @@ -5771,11 +5771,14 @@ }; #endif /* defined(AO2_DEBUG) || defined(AST_DEVMODE) */ -#if defined(AST_DEVMODE) +#if defined(AO2_DEBUG) || defined(AST_DEVMODE) static void astobj2_cleanup(void) { +#if defined(AST_DEVMODE) ao2_t_ref(reg_containers, -1, "Releasing container registration container"); reg_containers = NULL; +#endif + ast_cli_unregister_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2)); } #endif @@ -5788,10 +5791,10 @@ if (!reg_containers) { return -1; } - ast_register_atexit(astobj2_cleanup); #endif /* defined(AST_DEVMODE) */ #if defined(AO2_DEBUG) || defined(AST_DEVMODE) ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2)); + ast_register_atexit(astobj2_cleanup); #endif /* defined(AO2_DEBUG) || defined(AST_DEVMODE) */ return 0;