From 81859050c36ddfaaf62ff027ef41ff8c5b2ea46e Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Thu, 18 Aug 2016 15:51:43 -0500 Subject: [PATCH] Fix cfstore_test_delete_all by removing swap Remove the handle swap in cfstore_test_delete_all. This prevents a deleted handle from being used. --- .../storage/FEATURE_STORAGE/cfstore/source/cfstore_test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/features/storage/FEATURE_STORAGE/cfstore/source/cfstore_test.c b/features/storage/FEATURE_STORAGE/cfstore/source/cfstore_test.c index 700e4e4b25..13aae8b1d0 100644 --- a/features/storage/FEATURE_STORAGE/cfstore/source/cfstore_test.c +++ b/features/storage/FEATURE_STORAGE/cfstore/source/cfstore_test.c @@ -374,7 +374,11 @@ int32_t cfstore_test_delete_all(void) CFSTORE_ERRLOG("%s:Error: failed to delete key_name=%s, len=%d\r\n", __func__, key_name, (int) len); return ret; } - CFSTORE_HANDLE_SWAP(prev, next); + ret = drv->Close(next); + if(ret < ARM_DRIVER_OK){ + CFSTORE_ERRLOG("%s:Error: failed to close key_name=%s, len=%d\r\n", __func__, key_name, (int) len); + return ret; + } } if(ret == ARM_CFSTORE_DRIVER_ERROR_KEY_NOT_FOUND) { /* as expected, no more keys have been found by the Find()*/