Skip to content

Commit 93da92c

Browse files
pdgendtcfriedt
authored andcommitted
samples: modules: nanopb: Release decoded message
If CONFIG_NANOPB_ENABLE_MALLOC is enabled, any successfully decoded message should be released. Update the sample, to lead by example. Signed-off-by: Pieter De Gendt <[email protected]>
1 parent 3993a73 commit 93da92c

File tree

1 file changed

+1
-0
lines changed
  • samples/modules/nanopb/src

1 file changed

+1
-0
lines changed

samples/modules/nanopb/src/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ bool decode_message(uint8_t *buffer, size_t message_length)
7373
#ifdef CONFIG_SAMPLE_UNLUCKY_NUMBER
7474
printk("Your unlucky number was %d!\n", (int)message.unlucky_number);
7575
#endif
76+
pb_release(SimpleMessage_fields, &message);
7677
} else {
7778
printk("Decoding failed: %s\n", PB_GET_ERROR(&stream));
7879
}

0 commit comments

Comments
 (0)