summaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2015-04-03 21:07:14 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2015-04-03 21:07:14 +0300
commit1cfe56060ce3a386c03239396d51a93baa56895b (patch)
tree5c345182af94a462db79820a58ac1a7c03f96ea4 /pb_decode.c
parentb1b28517708ec6d03f7aba5d4f3c8252a7880d20 (diff)
Clear callbacks for union fields.
Update issue 148 Status: FixedInGit
Diffstat (limited to 'pb_decode.c')
-rw-r--r--pb_decode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 4d8c7cb..b21bfe3 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -398,6 +398,9 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
*(pb_size_t*)iter->pSize = iter->pos->tag;
if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE)
{
+ /* We memset to zero so that any callbacks are set to NULL.
+ * Then set any default values. */
+ memset(iter->pData, 0, iter->pos->data_size);
pb_message_set_to_defaults((const pb_field_t*)iter->pos->ptr, iter->pData);
}
return func(stream, iter->pos, iter->pData);