diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c index f916a8d852..79ea1453af 100644 --- a/cdr/cdr_odbc.c +++ b/cdr/cdr_odbc.c @@ -346,7 +346,6 @@ static int odbc_load_module(void) goto out; } - ast_config_destroy(cfg); if (option_verbose > 2) { ast_verbose( VERBOSE_PREFIX_3 "cdr_odbc: dsn is %s\n",dsn); if (username) @@ -371,6 +370,8 @@ static int odbc_load_module(void) ast_log(LOG_ERROR, "cdr_odbc: Unable to register ODBC CDR handling\n"); } out: + if (cfg) + ast_config_destroy(cfg); ast_mutex_unlock(&odbc_lock); return res; }