Explorar o código

README: Add note about needing to free print results in examples

Max Bruckner %!s(int64=6) %!d(string=hai) anos
pai
achega
cb1df2f88c
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      README.md

+ 2 - 0
README.md

@@ -298,6 +298,7 @@ In this example we want to build and parse the following JSON:
 Let's build the above JSON and print it to a string:
 Let's build the above JSON and print it to a string:
 ```c
 ```c
 //create a monitor with a list of supported resolutions
 //create a monitor with a list of supported resolutions
+//NOTE: Returns a heap allocated string, you are required to free it after use.
 char* create_monitor(void)
 char* create_monitor(void)
 {
 {
     const unsigned int resolution_numbers[3][2] = {
     const unsigned int resolution_numbers[3][2] = {
@@ -373,6 +374,7 @@ end:
 
 
 Alternatively we can use the `cJSON_Add...ToObject` helper functions to make our lifes a little easier:
 Alternatively we can use the `cJSON_Add...ToObject` helper functions to make our lifes a little easier:
 ```c
 ```c
+//NOTE: Returns a heap allocated string, you are required to free it after use.
 char *create_monitor_with_helpers(void)
 char *create_monitor_with_helpers(void)
 {
 {
     const unsigned int resolution_numbers[3][2] = {
     const unsigned int resolution_numbers[3][2] = {