diff --git a/src/storage.h b/src/storage.h
index 29bd5067c766c240588fca2257ef6bc2bcb0f4aa..9c9f9db94abbf4b2fc12c38511155a35cd4a4234 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -37,8 +37,7 @@ public:
         storedValues_.emplace(expiration, std::pair<InfoHash, Value::Id>(id, value.id));
     }
     void erase(const InfoHash& id, const Value& value, time_point expiration) {
-        auto size = value.size();
-        totalSize_ -= size;
+        totalSize_ -= value.size();
         auto range = storedValues_.equal_range(expiration);
         for (auto rit = range.first; rit != range.second;) {
             if (rit->second.first == id && rit->second.second == value.id) {