Module: kamailio
Branch: 4.2
Commit: 0d47a5cfc723be2b8ef2baeb439d5df05b5c580c
URL:
https://github.com/kamailio/kamailio/commit/0d47a5cfc723be2b8ef2baeb439d5df…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-02-04T18:07:04+01:00
sca: initialize sca variable to catch destroy on shutdown at startup
- reported by GH#35
(cherry picked from commit 010977f5febcf923a31d545bd631fbee11dd426c)
---
Modified: modules/sca/sca.c
---
Diff:
https://github.com/kamailio/kamailio/commit/0d47a5cfc723be2b8ef2baeb439d5df…
Patch:
https://github.com/kamailio/kamailio/commit/0d47a5cfc723be2b8ef2baeb439d5df…
---
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();