mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Add safety NULL pointer check in module user references.
Made __ast_module_user_remove() check for NULL pointers. ........ Merged revision 375860 from C.3 ........ Merged revisions 375862 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 375863 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 375864 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375865 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -210,13 +210,14 @@ void ast_module_unregister(const struct ast_module_info *info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ast_module_user *__ast_module_user_add(struct ast_module *mod,
|
struct ast_module_user *__ast_module_user_add(struct ast_module *mod, struct ast_channel *chan)
|
||||||
struct ast_channel *chan)
|
|
||||||
{
|
{
|
||||||
struct ast_module_user *u = ast_calloc(1, sizeof(*u));
|
struct ast_module_user *u;
|
||||||
|
|
||||||
if (!u)
|
u = ast_calloc(1, sizeof(*u));
|
||||||
|
if (!u) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
u->chan = chan;
|
u->chan = chan;
|
||||||
|
|
||||||
@@ -233,6 +234,9 @@ struct ast_module_user *__ast_module_user_add(struct ast_module *mod,
|
|||||||
|
|
||||||
void __ast_module_user_remove(struct ast_module *mod, struct ast_module_user *u)
|
void __ast_module_user_remove(struct ast_module *mod, struct ast_module_user *u)
|
||||||
{
|
{
|
||||||
|
if (!u) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
AST_LIST_LOCK(&mod->users);
|
AST_LIST_LOCK(&mod->users);
|
||||||
AST_LIST_REMOVE(&mod->users, u, entry);
|
AST_LIST_REMOVE(&mod->users, u, entry);
|
||||||
AST_LIST_UNLOCK(&mod->users);
|
AST_LIST_UNLOCK(&mod->users);
|
||||||
|
Reference in New Issue
Block a user