diff --git a/tests/test_format_api.c b/tests/test_format_api.c
index b5140919e40b73ddd4c5eb9dd382e0c71c6b10ab..c429e08954c56ca93201b32f5751bf1f561064d9 100644
--- a/tests/test_format_api.c
+++ b/tests/test_format_api.c
@@ -575,7 +575,6 @@ static int container_test1_helper(struct ast_format_cap *cap1, struct ast_format
 		if (!video || !audio || !text || !image) {
 			ast_test_status_update(test, "failed to add all\n");
 			res = AST_TEST_FAIL;
-			ast_format_cap_iter_end(cap_joint);
 			goto test3_cleanup;
 		}
 	}