Skip to content

Commit

Permalink
[kvs] fix kvs leak (#25814)
Browse files Browse the repository at this point in the history
  • Loading branch information
pankore authored and pull[bot] committed Aug 29, 2023
1 parent 5f73eb2 commit d87d5c1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/platform/Ameba/KeyValueStoreManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value,
return (err = CHIP_ERROR_INVALID_ARGUMENT);
}

if (checkExist(key, key))
{
ret = deleteKey(key, key);
if (TRUE != ret)
{
ChipLogError(DeviceLayer, "Warning, KVS leakage, failed to remove old kvs value");
}
}

ret = setPref_new(key, key, (uint8_t *) value, value_size);

if (TRUE == ret)
Expand Down

0 comments on commit d87d5c1

Please sign in to comment.