[asterisk-commits] rmudgett: branch 1.8 r375862 - /branches/1.8/main/loader.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 5 15:37:00 CST 2012
Author: rmudgett
Date: Mon Nov 5 15:36:56 2012
New Revision: 375862
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=375862
Log:
Add safety NULL pointer check in module user references.
Made __ast_module_user_remove() check for NULL pointers.
........
Merged revision 375860 from C.3
Modified:
branches/1.8/main/loader.c
Modified: branches/1.8/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/loader.c?view=diff&rev=375862&r1=375861&r2=375862
==============================================================================
--- branches/1.8/main/loader.c (original)
+++ branches/1.8/main/loader.c Mon Nov 5 15:36:56 2012
@@ -206,13 +206,14 @@
}
}
-struct ast_module_user *__ast_module_user_add(struct ast_module *mod,
- struct ast_channel *chan)
-{
- struct ast_module_user *u = ast_calloc(1, sizeof(*u));
-
- if (!u)
+struct ast_module_user *__ast_module_user_add(struct ast_module *mod, struct ast_channel *chan)
+{
+ struct ast_module_user *u;
+
+ u = ast_calloc(1, sizeof(*u));
+ if (!u) {
return NULL;
+ }
u->chan = chan;
@@ -229,6 +230,9 @@
void __ast_module_user_remove(struct ast_module *mod, struct ast_module_user *u)
{
+ if (!u) {
+ return;
+ }
AST_LIST_LOCK(&mod->users);
AST_LIST_REMOVE(&mod->users, u, entry);
AST_LIST_UNLOCK(&mod->users);
More information about the asterisk-commits
mailing list