@ -165,6 +165,13 @@ static struct stasis_state *state_alloc(struct stasis_state_manager *manager,
return NULL ;
return NULL ;
}
}
ast_free ( name ) ;
ast_free ( name ) ;
} else {
/*
* Since the state topic was passed in , go ahead and bump its reference .
* By doing this here first , it allows us to consistently decrease the reference on
* state allocation error .
*/
ao2_ref ( state_topic , + 1 ) ;
}
}
if ( ! id ) {
if ( ! id ) {
@ -175,13 +182,6 @@ static struct stasis_state *state_alloc(struct stasis_state_manager *manager,
id = state_id_by_topic ( manager - > all_topic , state_topic ) ;
id = state_id_by_topic ( manager - > all_topic , state_topic ) ;
}
}
/*
* Since the state topic could have been passed in , go ahead and bump its reference .
* By doing this here first , it allows us to consistently decrease the reference on
* state allocation error .
*/
ao2_ref ( state_topic , + 1 ) ;
state = ao2_alloc ( sizeof ( * state ) + strlen ( id ) + 1 , state_dtor ) ;
state = ao2_alloc ( sizeof ( * state ) + strlen ( id ) + 1 , state_dtor ) ;
if ( ! state ) {
if ( ! state ) {
ast_log ( LOG_ERROR , " Unable to allocate state '%s' in manager '%s' \n " ,
ast_log ( LOG_ERROR , " Unable to allocate state '%s' in manager '%s' \n " ,