[asterisk-commits] rmudgett: branch 11 r375864 - in /branches/11: ./ main/loader.c

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


Author: rmudgett
Date: Mon Nov  5 15:41:04 2012
New Revision: 375864

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

Modified:
    branches/11/   (props changed)
    branches/11/main/loader.c

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

Modified: branches/11/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/loader.c?view=diff&rev=375864&r1=375863&r2=375864
==============================================================================
--- branches/11/main/loader.c (original)
+++ branches/11/main/loader.c Mon Nov  5 15:41:04 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