mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 04:11:08 +00:00
stasis_message.c: Don't create immutable stasis objects with locks.
* Create the stasis message object without a lock as it is immutable. * Create the stasis message type object without a lock as it is immutable. * Creating the stasis message type could crash if the passed in type name is NULL and REF_DEBUG is enabled. Added missing NULL check when passing the ao2 object tag string. Change-Id: I28763c58bb9f0b427c11971d0103bf94055e7b32
This commit is contained in:
@@ -61,7 +61,8 @@ int stasis_message_type_create(const char *name,
|
|||||||
return STASIS_MESSAGE_TYPE_DECLINED;
|
return STASIS_MESSAGE_TYPE_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = ao2_t_alloc(sizeof(*type), message_type_dtor, name);
|
type = ao2_t_alloc_options(sizeof(*type), message_type_dtor,
|
||||||
|
AO2_ALLOC_OPT_LOCK_NOLOCK, name ?: "");
|
||||||
if (!type) {
|
if (!type) {
|
||||||
return STASIS_MESSAGE_TYPE_ERROR;
|
return STASIS_MESSAGE_TYPE_ERROR;
|
||||||
}
|
}
|
||||||
@@ -121,7 +122,8 @@ struct stasis_message *stasis_message_create_full(struct stasis_message_type *ty
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
message = ao2_t_alloc(sizeof(*message), stasis_message_dtor, type->name);
|
message = ao2_t_alloc_options(sizeof(*message), stasis_message_dtor,
|
||||||
|
AO2_ALLOC_OPT_LOCK_NOLOCK, type->name);
|
||||||
if (message == NULL) {
|
if (message == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user