Skip to content

Commit

Permalink
sca: more error handling during initialization of the module
Browse files Browse the repository at this point in the history
- 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 df2a455)
(cherry picked from commit da06d9a)
  • Loading branch information
miconda committed Feb 4, 2015
1 parent be2fc82 commit 34305cf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions modules/sca/sca.c
Expand Up @@ -208,6 +208,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 ) {
outbound_proxy.len = strlen( outbound_proxy.s );
Expand Down Expand Up @@ -295,23 +296,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,
Expand Down

0 comments on commit 34305cf

Please sign in to comment.