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 Feb 2, 2024
1 parent ee27f9d commit 95520c0
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 95520c0

Please sign in to comment.