@ -1077,22 +1077,23 @@ static void subscription_change_dtor(void *obj)
{
{
struct stasis_subscription_change * change = obj ;
struct stasis_subscription_change * change = obj ;
ast_string_field_free_memory ( change ) ;
ao2_cleanup ( change - > topic ) ;
ao2_cleanup ( change - > topic ) ;
}
}
static struct stasis_subscription_change * subscription_change_alloc ( struct stasis_topic * topic , const char * uniqueid , const char * description )
static struct stasis_subscription_change * subscription_change_alloc ( struct stasis_topic * topic , const char * uniqueid , const char * description )
{
{
size_t description_len = strlen ( description ) + 1 ;
struct stasis_subscription_change * change ;
struct stasis_subscription_change * change ;
change = ao2_alloc ( sizeof ( struct stasis_subscription_change ) , subscription_change_dtor ) ;
change = ao2_alloc _options( sizeof ( * change ) + description_len + strlen ( uniqueid ) + 1 ,
if ( ! change | | ast_string_field_init ( change , 128 ) ) {
subscription_change_dtor , AO2_ALLOC_OPT_LOCK_NOLOCK ) ;
ao2_cleanup ( change ) ;
if ( ! change ) {
return NULL ;
return NULL ;
}
}
ast_string_field_set ( change , uniqueid , uniqueid ) ;
strcpy ( change - > description , description ) ; /* SAFE */
ast_string_field_set ( change , description , description ) ;
change - > uniqueid = change - > description + description_len ;
strcpy ( change - > uniqueid , uniqueid ) ; /* SAFE */
ao2_ref ( topic , + 1 ) ;
ao2_ref ( topic , + 1 ) ;
change - > topic = topic ;
change - > topic = topic ;