Module: kamailio
Branch: master
Commit: 010977f5febcf923a31d545bd631fbee11dd426c
URL:
https://github.com/kamailio/kamailio/commit/010977f5febcf923a31d545bd631fbe…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-01-28T22:09:21+01:00
sca: initialize sca variable to catch destroy on shutdown at startup
- reported by GH#35
---
Modified: modules/sca/sca.c
---
Diff:
https://github.com/kamailio/kamailio/commit/010977f5febcf923a31d545bd631fbe…
Patch:
https://github.com/kamailio/kamailio/commit/010977f5febcf923a31d545bd631fbe…
---
diff --git a/modules/sca/sca.c b/modules/sca/sca.c
index 743ec96..e739e18 100644
--- a/modules/sca/sca.c
+++ b/modules/sca/sca.c
@@ -40,7 +40,7 @@
MODULE_VERSION
/* MODULE OBJECT */
-sca_mod *sca;
+sca_mod *sca = NULL;
/* EXTERNAL API */
@@ -363,10 +363,15 @@ sca_mod_init( void )
void
sca_mod_destroy( void )
{
+ if(sca==0)
+ return;
+
/* write back to the DB to retain most current subscription info */
if ( sca_subscription_db_update() != 0 ) {
- LM_ERR( "sca_mod_destroy: failed to save current subscriptions "
- "in DB %.*s", STR_FMT( sca->cfg->db_url ));
+ if(sca && sca->cfg && sca->cfg->db_url) {
+ LM_ERR( "sca_mod_destroy: failed to save current subscriptions "
+ "in DB %.*s", STR_FMT( sca->cfg->db_url ));
+ }
}
sca_db_disconnect();