From 9eb760d1d5edba6afa289a6edc6daf05050f80fe Mon Sep 17 00:00:00 2001 From: Varada Kari Date: Fri, 15 May 2015 19:46:26 +0530 Subject: [PATCH] KeyValueStore: Fix the prefix comparion to avoid object leaks. Iterator becomes invalid due to a partial prefix comparision in rmkeys_by_prefix, resulting in not deleting the objects from backend. Modified the comparision to the given prefix. Signed-off-by: Varada Kari --- src/os/KeyValueDB.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/KeyValueDB.h b/src/os/KeyValueDB.h index d1698c0382cc8..6568df8968924 100644 --- a/src/os/KeyValueDB.h +++ b/src/os/KeyValueDB.h @@ -130,7 +130,7 @@ public: if (!generic_iter->valid()) return false; pair raw_key = generic_iter->raw_key(); - return (raw_key.first == prefix); + return (raw_key.first.compare(0, prefix.length(), prefix) == 0); } int next() { if (valid()) -- 2.39.5