[asterisk-commits] jpeeler: branch jpeeler/feature14882 r282233 - /team/jpeeler/feature14882/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 13 12:46:40 CDT 2010


Author: jpeeler
Date: Fri Aug 13 12:46:36 2010
New Revision: 282233

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=282233
Log:
Calling ao2_ref on a NULL pointer is bad, thanks Qwell!

Modified:
    team/jpeeler/feature14882/main/features.c

Modified: team/jpeeler/feature14882/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/feature14882/main/features.c?view=diff&rev=282233&r1=282232&r2=282233
==============================================================================
--- team/jpeeler/feature14882/main/features.c (original)
+++ team/jpeeler/feature14882/main/features.c Fri Aug 13 12:46:36 2010
@@ -1029,7 +1029,6 @@
 /*! \brief Park a call */
 int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, const char *parkexten, int *extout)
 {
-	/* JPEELER check reference handling */
 	struct ast_parkinglot *found_lot = ao2_callback(parkinglots, 0, find_parkinglot_by_exten_cb, (void *) parkexten);
 
 	struct ast_park_call_args args = {
@@ -3896,7 +3895,10 @@
 	if (ast_strlen_zero(name)) { /* No name specified */
 		return NULL;
 	}
-	if (ao2_ref(find_parkinglot(name), -1)) { /* Parkinglot with that name allready exists */
+	if ((copylot = find_parkinglot(name))) { /* Parkinglot with that name already exists */
+		if (copylot) {
+			ao2_ref(copylot, -1);
+		}
 		return NULL;
 	}
 
@@ -3988,7 +3990,6 @@
 		ast_app_parse_options(park_call_options, &flags, NULL, app_args.options);
 		args.flags = flags.flags;
 
-		/* JPEELER: this appears unsafe */
 		args.parkinglot = ao2_callback(parkinglots, 0, find_parkinglot_by_exten_cb, &orig_exten);
 		res = masq_park_call_announce(chan, chan, &args);
 		/* Continue on in the dialplan */




More information about the asterisk-commits mailing list