From: Varada Kari Date: Fri, 15 May 2015 14:16:26 +0000 (+0530) Subject: KeyValueStore: Fix the prefix comparion to avoid object leaks. X-Git-Tag: v9.0.2~142^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9eb760d1d5edba6afa289a6edc6daf05050f80fe;p=ceph.git 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 --- diff --git a/src/os/KeyValueDB.h b/src/os/KeyValueDB.h index d1698c0382cc..6568df896892 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())