mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
dht: prevent potential use-after-free in storageChanged
This commit is contained in:
1 parent
92b08bbbc9
commit
9991c976ff
1 file changed
+5
-1
+5
-1
@@ -1282,9 +1282,13 @@ Dht::storageStore(const InfoHash& id, const Sp<Value>& value, time_point created
|
||||
vs->expiration_job = scheduler.add(expiration, std::bind(&Dht::expireStorage, this, id));
|
||||
}
|
||||
if (total_store_size > max_store_size) {
|
||||
auto value = vs->data;
|
||||
auto value_diff = store.second.values_diff;
|
||||
expireStore();
|
||||
storageChanged(id, st->second, value, value_diff > 0);
|
||||
} else {
|
||||
storageChanged(id, st->second, vs->data, store.second.values_diff > 0);
|
||||
}
|
||||
storageChanged(id, st->second, vs->data, store.second.values_diff > 0);
|
||||
}
|
||||
|
||||
return std::get<0>(store);
|
||||
|
||||
Reference in new issue
Block a user