Correct test_cel cleanup.
authorDavid M. Lee <dlee@digium.com>
Thu, 11 Jul 2013 15:37:51 +0000 (15:37 +0000)
committerDavid M. Lee <dlee@digium.com>
Thu, 11 Jul 2013 15:37:51 +0000 (15:37 +0000)
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

index aef6201..d785ef1 100644 (file)
@@ -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;