[sr-dev] git:4.2:da06d9a4: sca: more error handling during initialization of the module
Daniel-Constantin Mierla
miconda at gmail.com
Wed Feb 4 18:10:58 CET 2015
Module: kamailio
Branch: 4.2
Commit: da06d9a4912f71b3e9f7af3d29a1543a4884efa9
URL: https://github.com/kamailio/kamailio/commit/da06d9a4912f71b3e9f7af3d29a1543a4884efa9
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-02-04T18:07:32+01:00
sca: more error handling during initialization of the module
- fix crash when the module doesn't initialize and calls destroy
function during shutdonw at startup
- reported by Olle E. Johansson, GH#57
(cherry picked from commit df2a45541c5e37907374c5e7595de1f30ea84f98)
---
Modified: modules/sca/sca.c
---
Diff: https://github.com/kamailio/kamailio/commit/da06d9a4912f71b3e9f7af3d29a1543a4884efa9.diff
Patch: https://github.com/kamailio/kamailio/commit/da06d9a4912f71b3e9f7af3d29a1543a4884efa9.patch
---
diff --git a/modules/sca/sca.c b/modules/sca/sca.c
index e739e18..920024b 100644
--- a/modules/sca/sca.c
+++ b/modules/sca/sca.c
@@ -210,6 +210,7 @@ sca_set_config( sca_mod *scam )
LM_ERR( "Failed to shm_malloc module configuration" );
return( -1 );
}
+ memset(scam->cfg, 0, sizeof( sca_config ));
if ( outbound_proxy.s ) {
scam->cfg->outbound_proxy = &outbound_proxy;
@@ -293,23 +294,23 @@ sca_mod_init( void )
if ( rpc_register_array( sca_rpc ) != 0 ) {
LM_ERR( "Failed to register RPC commands" );
- return( -1 );
+ goto error;
}
if ( sca_bind_srdb1( sca, &dbf ) != 0 ) {
LM_ERR( "Failed to initialize required DB API" );
- return( -1 );
+ goto error;
}
if ( load_tm_api( &tmb ) != 0 ) {
LM_ERR( "Failed to initialize required tm API" );
- return( -1 );
+ goto error;
}
sca->tm_api = &tmb;
if ( sca_bind_sl( sca, &slb ) != 0 ) {
LM_ERR( "Failed to initialize required sl API" );
- return( -1 );
+ goto error;
}
if ( sca_hash_table_create( &sca->subscriptions,
More information about the sr-dev
mailing list