From 9c196b89ba04733529edfe970af6307a34de1662 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Wed, 12 Mar 2014 21:08:35 +0200 Subject: Add pb_release() function --- pb_decode.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pb_decode.h') diff --git a/pb_decode.h b/pb_decode.h index f71b5f1b..2e1da5a6 100644 --- a/pb_decode.h +++ b/pb_decode.h @@ -82,6 +82,14 @@ bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *des */ bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct); +#ifdef PB_ENABLE_MALLOC +/* Release any allocated pointer fields. If you use dynamic allocation, you should + * call this for any decoded message when you are done with it. You also need to + * free messages even if pb_decode() returned with error. + */ +void pb_release(const pb_field_t fields[], void *dest_struct); +#endif + /************************************** * Functions for manipulating streams * -- cgit 1.2.3-korg