mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-03 11:00:14 -05:00
fixed two memory bugs in serialization code
This commit is contained in:
parent
31c07f4dfd
commit
91b04098b6
@ -75,7 +75,7 @@ RsChatAvatarItem::~RsChatAvatarItem()
|
|||||||
{
|
{
|
||||||
if(image_data != NULL)
|
if(image_data != NULL)
|
||||||
{
|
{
|
||||||
delete[] image_data ;
|
free(image_data) ;
|
||||||
image_data = NULL ;
|
image_data = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,17 +134,16 @@ void RsDiscContactItem::serial_process(SerializeJob j,SerializeContext& ctx)
|
|||||||
|
|
||||||
// This is a hack. Normally we should have to different item types, in order to avoid this nonesense.
|
// This is a hack. Normally we should have to different item types, in order to avoid this nonesense.
|
||||||
|
|
||||||
if( (j == RsItem::DESERIALIZE && GetTlvType( &(((uint8_t *) ctx.mData)[ctx.mOffset]) )==TLV_TYPE_STR_DOMADDR) || isHidden)
|
if(j == RsItem::DESERIALIZE)
|
||||||
{
|
isHidden = ( GetTlvType( &(((uint8_t *) ctx.mData)[ctx.mOffset]) )==TLV_TYPE_STR_DOMADDR);
|
||||||
isHidden = true ;
|
|
||||||
|
|
||||||
|
if(isHidden)
|
||||||
|
{
|
||||||
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_DOMADDR,hiddenAddr,"hiddenAddr");
|
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_DOMADDR,hiddenAddr,"hiddenAddr");
|
||||||
RsTypeSerializer::serial_process<uint16_t>(j,ctx,hiddenPort,"hiddenPort");
|
RsTypeSerializer::serial_process<uint16_t>(j,ctx,hiddenPort,"hiddenPort");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isHidden = false ;
|
|
||||||
|
|
||||||
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,localAddrV4,"localAddrV4");
|
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,localAddrV4,"localAddrV4");
|
||||||
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx, extAddrV4,"extAddrV4");
|
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx, extAddrV4,"extAddrV4");
|
||||||
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,localAddrV6,"localAddrV6");
|
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,localAddrV6,"localAddrV6");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user