From 41f764afa3a54259c86cf624a23f9ab9651c3cd1 Mon Sep 17 00:00:00 2001 From: Kevin Harwell Date: Fri, 3 Jan 2014 21:57:11 +0000 Subject: [PATCH] cel_pgsql: module not correctly reloading Upon reload the module unconditionally "unloaded" the module (freeing memory and setting pointers to NULL) and then when attempting a "load" if the config file had not changed then nothing would be reinitialized. By moving the "unload" to occur conditionally (reload only) after an attempted configuration load, but before module "loading" alleviates the issue. The module now loads/unloads/reloads correctly. (closes issue ASTERISK-22871) Reported by: Matteo git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@404857 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- cel/cel_pgsql.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cel/cel_pgsql.c b/cel/cel_pgsql.c index 58d7a4f5f5..3b44d71d9b 100644 --- a/cel/cel_pgsql.c +++ b/cel/cel_pgsql.c @@ -542,6 +542,10 @@ static int my_load_module(int reload) return AST_MODULE_LOAD_SUCCESS; } + if (reload) { + my_unload_module(); + } + process_my_load_module(cfg); ast_config_destroy(cfg); @@ -562,7 +566,6 @@ static int load_module(void) static int reload(void) { - my_unload_module(); return my_load_module(1); }