[asterisk-commits] rmudgett: trunk r375865 - in /trunk: ./ main/loader.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 5 15:42:52 CST 2012


Author: rmudgett
Date: Mon Nov  5 15:42:49 2012
New Revision: 375865

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=375865
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
........

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

Modified:
    trunk/   (props changed)
    trunk/main/loader.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: trunk/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/loader.c?view=diff&rev=375865&r1=375864&r2=375865
==============================================================================
--- trunk/main/loader.c (original)
+++ trunk/main/loader.c Mon Nov  5 15:42:49 2012
@@ -210,13 +210,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;
 
@@ -233,6 +234,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