summaryrefslogtreecommitdiffstats
path: root/pb_decode.h
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-03-12 21:08:35 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-03-12 21:08:35 +0200
commit9c196b89ba04733529edfe970af6307a34de1662 (patch)
tree5f1c492d0cd425520234a8a2d12cf4dfe7715bad /pb_decode.h
parentbf61d2337b4107b2c37c35bb41c7b809d8f3feb9 (diff)
Add pb_release() function
Diffstat (limited to 'pb_decode.h')
-rw-r--r--pb_decode.h8
1 files changed, 8 insertions, 0 deletions
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 *