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

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


Author: jpeeler
Date: Fri Aug 13 12:32:07 2010
New Revision: 282232

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=282232
Log:
Looking for a reference count problem that didn't exist allowed me to find some that did.

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=282232&r1=282231&r2=282232
==============================================================================
--- team/jpeeler/feature14882/main/features.c (original)
+++ team/jpeeler/feature14882/main/features.c Fri Aug 13 12:32:07 2010
@@ -3896,7 +3896,7 @@
 	if (ast_strlen_zero(name)) { /* No name specified */
 		return NULL;
 	}
-	if (find_parkinglot(name)) { /* Parkinglot with that name allready exists */
+	if (ao2_ref(find_parkinglot(name), -1)) { /* Parkinglot with that name allready exists */
 		return NULL;
 	}
 
@@ -4213,6 +4213,7 @@
 		return NULL;
 
 	newlot = ao2_alloc(sizeof(*newlot), parkinglot_destroy);
+ast_log(LOG_WARNING, "jpeeler: ref count %d\n", ao2_ref(newlot, 0));
 	if (!newlot)
 		return NULL;
 	
@@ -4231,6 +4232,7 @@
 	if (con)
 		ast_context_destroy(con, registrar);
 	ao2_unlink(parkinglots, ruin);
+	ao2_ref(ruin, -1);
 }
 
 /*! 
@@ -4418,9 +4420,7 @@
 	iter = ao2_iterator_init(parkinglots, 0);
 	while ((curlot = ao2_iterator_next(&iter))) {
 		parkinglot_destroy(curlot);
-		ao2_ref(curlot, -1);
-	}
-	default_parkinglot = NULL;
+	}
 
 	default_parkinglot = build_parkinglot(DEFAULT_PARKINGLOT, NULL);
 	if (default_parkinglot) {
@@ -5046,7 +5046,8 @@
 	iter = ao2_iterator_init(parkinglots, 0);
 	while ((curlot = ao2_iterator_next(&iter))) {
 		int lotparked = 0;
-		ast_cli(a->fd, "*** Parking lot: %s (%d)\n", curlot->name, ao2_ref(curlot, 0));
+		/* subtract ref for iterator and for configured parking lot */
+		ast_cli(a->fd, "*** Parking lot: %s (%d)\n", curlot->name, ao2_ref(curlot, 0) - 2);
 
 		AST_LIST_LOCK(&curlot->parkings);
 		AST_LIST_TRAVERSE(&curlot->parkings, cur, list) {
@@ -5606,6 +5607,7 @@
 	ast_register_application2(app_bridge, bridge_exec, NULL, NULL, NULL);
 
 	parkinglots = ao2_container_alloc(7, parkinglot_hash_cb, parkinglot_cmp_cb);
+ast_log(LOG_WARNING, "jpeeler: ref count %d\n", ao2_ref(parkinglots, 0));
 
 	if ((res = load_config()))
 		return res;




More information about the asterisk-commits mailing list