Skip to content

fix potential segfault with cjson if cjson uses custom malloc

Gabriel Zachmann requested to merge zachmann/mustach:master into master

This Merge request fixes a potential segmentation fault with the cjson part.

cJSON offers the possibility to set custom malloc and free functions. If set, cJSON uses these to allocate/deallocate memory. This is also the case in the call to cJSON_PrintUnformatted. mustach eventuallty frees that output with free; if a custom allocation is sued in cJSON this will most likely result in a segmentation fault. Instead the cJSON_free function should be used, this one uses the correct de-allocation function.

Merge request reports