aboutsummaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
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 4d8c7cbe..b21bfe37 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);