lua-yajl icon indicating copy to clipboard operation
lua-yajl copied to clipboard

Memory leak in js_to_value

Open kyzentun opened this issue 3 years ago • 0 comments

If one of the js_parser_assert conditions fails, the parser handle is leaked. This can be tested by adding an invalid json string to the test script.

            handle = <span class="pl-c1">yajl_alloc</span>(&amp;js_to_value_callbacks, <span class="pl-c1">NULL</span>, (<span class="pl-k">void</span>*)L);

This handle needs to be encapsulated in a userdata, the way the handle js_parser is, with a gc function so it is freed when the object is garbage collected.

kyzentun avatar Jun 15 '21 00:06 kyzentun