From 0342ae40c612c85917874babf1a34a4bdbdeb700 Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Wed, 9 Aug 2023 00:27:32 +0800 Subject: [PATCH] [kvs] replace checkexist with deletekey (#28513) - checkexist doesnt work on certain keys - just use deletekey which will search for the key and delete it if found --- src/platform/Ameba/KeyValueStoreManagerImpl.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/platform/Ameba/KeyValueStoreManagerImpl.cpp b/src/platform/Ameba/KeyValueStoreManagerImpl.cpp index 282d58c47c1f65..386127c68656c7 100644 --- a/src/platform/Ameba/KeyValueStoreManagerImpl.cpp +++ b/src/platform/Ameba/KeyValueStoreManagerImpl.cpp @@ -88,16 +88,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, goto exit; } - if (checkExist(key, key)) - { - error = deleteKey(key, key); - err = AmebaUtils::MapError(error, AmebaErrorType::kDctError); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Warning, KVS leakage, failed to remove old kvs value"); - } - } - + deleteKey(key, key); // delete key if it exists error = setPref_new(key, key, (uint8_t *) value, value_size); err = AmebaUtils::MapError(error, AmebaErrorType::kDctError);