mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-29 01:08:50 -04:00
Fix memory management and deprecated removal from serialization
Fix missing RsDiscPgpKeyItem initialization Fix inconsistent new[]/delete[] usage in RsDiscPgpKeyItem and PGPHandler::exportPublicKey which now consistently uses malloc/free Remove deprecated RsGenericSerializer::FORMAT_* Move from deprecated RsServiceSerializer::SERIALIZATION_FLAG_* to RsSerializationFlags Solve a bunch of compiler warnings Stricter checks in SerializeContext costructor
This commit is contained in:
parent
39bde58c29
commit
5610cc8600
24 changed files with 230 additions and 244 deletions
|
@ -74,8 +74,8 @@ void RsDiscPgpKeyItem::clear()
|
|||
{
|
||||
pgpKeyId.clear();
|
||||
free(bin_data);
|
||||
bin_data = nullptr;
|
||||
bin_len=0;
|
||||
bin_data = nullptr;
|
||||
bin_len = 0;
|
||||
}
|
||||
|
||||
void RsDiscContactItem::clear()
|
||||
|
|
|
@ -84,17 +84,23 @@ class RsDiscPgpKeyItem: public RsDiscItem
|
|||
{
|
||||
public:
|
||||
|
||||
RsDiscPgpKeyItem() : RsDiscItem(RsGossipDiscoveryItemType::PGP_CERT_BINARY)
|
||||
RsDiscPgpKeyItem() :
|
||||
RsDiscItem(RsGossipDiscoveryItemType::PGP_CERT_BINARY),
|
||||
bin_data(nullptr), bin_len(0)
|
||||
{ setPriorityLevel(QOS_PRIORITY_RS_DISC_PGP_CERT); }
|
||||
|
||||
virtual ~RsDiscPgpKeyItem() { delete[](bin_data);bin_data=nullptr;bin_len=0;}
|
||||
|
||||
~RsDiscPgpKeyItem() override { free(bin_data); }
|
||||
void clear() override;
|
||||
void serial_process( RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx) override;
|
||||
|
||||
RsPgpId pgpKeyId; // duplicate information for practical reasons
|
||||
unsigned char *bin_data; // binry key data allocated with new unsigned char[]
|
||||
uint32_t bin_len;
|
||||
void serial_process(
|
||||
RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx ) override;
|
||||
|
||||
/// duplicate information for practical reasons
|
||||
RsPgpId pgpKeyId;
|
||||
|
||||
unsigned char* bin_data;
|
||||
uint32_t bin_len;
|
||||
};
|
||||
|
||||
class RsDiscContactItem: public RsDiscItem
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue