aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pb_decode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 5cdcbcfb..50ada86a 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -1067,6 +1067,9 @@ void pb_release(const pb_field_t fields[], void *dest_struct)
{
pb_field_iter_t iter;
+ if (!dest_struct)
+ return; /* Ignore NULL pointers, similar to free() */
+
if (!pb_field_iter_begin(&iter, fields, dest_struct))
return; /* Empty message type */