From c2bb638f1f2e8e9c95dd6cf3c0a51d5d17ebde6b Mon Sep 17 00:00:00 2001
From: "David M. Lee" <dlee@digium.com>
Date: Thu, 11 Jul 2013 15:37:51 +0000
Subject: [PATCH] Correct test_cel cleanup.

When I corrected the CEL test crash in r394037, I didn't quite pay attention
to how the globals and locals were being shuffled around in the cleanup
callback. I removed the nulling of the global variables, which caused them
to be double cleaned.

This patch puts the global nulling code back (since the vars are cleaned up
by RAII_VARs), and removes the explicit ao2_cleanup() (since they were no-ops,
because the variables had just been nulled).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 tests/test_cel.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/test_cel.c b/tests/test_cel.c
index aef62017df..d785ef1f1b 100644
--- a/tests/test_cel.c
+++ b/tests/test_cel.c
@@ -1335,6 +1335,10 @@ static int cel_verify_and_cleanup_cb(struct ast_test_info *info, struct ast_test
 	ast_event_unsubscribe(event_sub);
 	event_sub = NULL;
 
+	/* cleaned up by RAII_VAR's */
+	cel_expected_events = NULL;
+	cel_received_events = NULL;
+
 	/* check events */
 	ast_test_validate(test, !check_events(local_expected, local_received));
 
@@ -1343,11 +1347,7 @@ static int cel_verify_and_cleanup_cb(struct ast_test_info *info, struct ast_test
 	ao2_cleanup(saved_config);
 	saved_config = NULL;
 
-	/* get rid of events */
-	ao2_cleanup(cel_received_events);
-	cel_received_events = NULL;
-	ao2_cleanup(cel_expected_events);
-	cel_expected_events = NULL;
+	/* clean up the locks */
 	ast_mutex_destroy(&sync_lock);
 	ast_cond_destroy(&sync_out);
 	return 0;
-- 
GitLab