Compare commits
1 Commits
master
...
b7add1e577
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7add1e577 |
@@ -962,16 +962,20 @@ void pb_release(const pb_field_t fields[], void *dest_struct)
|
|||||||
pb_free(*pItem);
|
pb_free(*pItem);
|
||||||
*pItem++ = NULL;
|
*pItem++ = NULL;
|
||||||
}
|
}
|
||||||
|
*(pb_size_t*)iter.pSize = 0;
|
||||||
}
|
}
|
||||||
else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE)
|
else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE)
|
||||||
{
|
{
|
||||||
/* Release fields in submessages */
|
/* Release fields in submessages */
|
||||||
void *pItem = *(void**)iter.pData;
|
void *pItem = *(void**)iter.pData;
|
||||||
size_t count = (pItem ? 1 : 0);
|
if (pItem)
|
||||||
|
{
|
||||||
|
pb_size_t count = 1;
|
||||||
|
|
||||||
if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
|
if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
|
||||||
{
|
{
|
||||||
count = *(size_t*)iter.pSize;
|
count = *(pb_size_t*)iter.pSize;
|
||||||
|
*(pb_size_t*)iter.pSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (count--)
|
while (count--)
|
||||||
@@ -980,6 +984,7 @@ void pb_release(const pb_field_t fields[], void *dest_struct)
|
|||||||
pItem = (uint8_t*)pItem + iter.pos->data_size;
|
pItem = (uint8_t*)pItem + iter.pos->data_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Release main item */
|
/* Release main item */
|
||||||
pb_free(*(void**)iter.pData);
|
pb_free(*(void**)iter.pData);
|
||||||
|
|||||||
Reference in New Issue
Block a user