mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
fixed memory leak
This commit is contained in:
22
NetDb.cpp
22
NetDb.cpp
@@ -515,6 +515,7 @@ namespace data
|
|||||||
auto floodfill = GetClosestFloodfill (buf + DATABASE_STORE_KEY_OFFSET, excluded);
|
auto floodfill = GetClosestFloodfill (buf + DATABASE_STORE_KEY_OFFSET, excluded);
|
||||||
if (floodfill)
|
if (floodfill)
|
||||||
{
|
{
|
||||||
|
excluded.insert (floodfill->GetIdentHash ());
|
||||||
auto floodMsg = NewI2NPShortMessage ();
|
auto floodMsg = NewI2NPShortMessage ();
|
||||||
uint8_t * payload = floodMsg->GetPayload ();
|
uint8_t * payload = floodMsg->GetPayload ();
|
||||||
memcpy (payload, buf, 33); // key + type
|
memcpy (payload, buf, 33); // key + type
|
||||||
@@ -544,13 +545,20 @@ namespace data
|
|||||||
i2p::DeleteI2NPMessage (m);
|
i2p::DeleteI2NPMessage (m);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CryptoPP::Gunzip decompressor;
|
try
|
||||||
decompressor.Put (buf + offset, size);
|
{
|
||||||
decompressor.MessageEnd();
|
CryptoPP::Gunzip decompressor;
|
||||||
uint8_t uncompressed[2048];
|
decompressor.Put (buf + offset, size);
|
||||||
size_t uncomressedSize = decompressor.MaxRetrievable ();
|
decompressor.MessageEnd();
|
||||||
decompressor.Get (uncompressed, uncomressedSize);
|
uint8_t uncompressed[2048];
|
||||||
AddRouterInfo (buf + DATABASE_STORE_KEY_OFFSET, uncompressed, uncomressedSize);
|
size_t uncomressedSize = decompressor.MaxRetrievable ();
|
||||||
|
decompressor.Get (uncompressed, uncomressedSize);
|
||||||
|
AddRouterInfo (buf + DATABASE_STORE_KEY_OFFSET, uncompressed, uncomressedSize);
|
||||||
|
}
|
||||||
|
catch (CryptoPP::Exception& ex)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "DatabaseStore: ", ex.what ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i2p::DeleteI2NPMessage (m);
|
i2p::DeleteI2NPMessage (m);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user