[asterisk-commits] rmudgett: branch 10 r375863 - in /branches/10: ./ main/loader.c

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


Author: rmudgett
Date: Mon Nov  5 15:39:00 2012
New Revision: 375863

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

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

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

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