[asterisk-commits] rmudgett: branch rmudgett/ao2_enhancements r371269 - /team/rmudgett/ao2_enhan...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 15 15:13:21 CDT 2012


Author: rmudgett
Date: Wed Aug 15 15:13:17 2012
New Revision: 371269

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=371269
Log:
Make hash integrity check verify the object count.

Modified:
    team/rmudgett/ao2_enhancements/main/astobj2.c

Modified: team/rmudgett/ao2_enhancements/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ao2_enhancements/main/astobj2.c?view=diff&rev=371269&r1=371268&r2=371269
==============================================================================
--- team/rmudgett/ao2_enhancements/main/astobj2.c (original)
+++ team/rmudgett/ao2_enhancements/main/astobj2.c Wed Aug 15 15:13:17 2012
@@ -2628,8 +2628,11 @@
 	int count_node_backward;
 	int count_obj_forward;
 	int count_obj_backward;
+	int count_total_obj;
 	struct hash_bucket_node *node;
 	struct hash_bucket_node *last;
+
+	count_total_obj = 0;
 
 	/* For each bucket in the container. */
 	for (bucket = 0; bucket < self->n_buckets; ++bucket) {
@@ -2721,6 +2724,15 @@
 			ast_log(LOG_ERROR, "Forward/backward object count does not match!\n");
 			return -1;
 		}
+
+		/* Accumulate found object counts. */
+		count_total_obj += count_obj_forward;
+	}
+
+	/* Check total obj count. */
+	if (count_total_obj != ao2_container_count(&self->common)) {
+		ast_log(LOG_ERROR, "Total object count does not match ao2_container_count()!\n");
+		return -1;
 	}
 
 	return 0;




More information about the asterisk-commits mailing list