diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-03-16 15:52:19 +0200 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-03-16 15:52:19 +0200 |
commit | ab62402059ff3752660ffc9f292cf210aef59be0 (patch) | |
tree | 669db214120b26e1ea939e4e529f1c434534ec95 /pb_decode.c | |
parent | 108864963faf54762629a8bdf1f8bd614f0abd16 (diff) |
Documentation updates
Diffstat (limited to 'pb_decode.c')
-rw-r--r-- | pb_decode.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pb_decode.c b/pb_decode.c index 81febb9..7938d70 100644 --- a/pb_decode.c +++ b/pb_decode.c @@ -894,8 +894,16 @@ bool checkreturn pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[ bool checkreturn pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) { + bool status; pb_message_set_to_defaults(fields, dest_struct); - return pb_decode_noinit(stream, fields, dest_struct); + status = pb_decode_noinit(stream, fields, dest_struct); + +#ifdef PB_ENABLE_MALLOC + if (!status) + pb_release(fields, dest_struct); +#endif + + return status; } bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) |