fix: memory leak in the SpaceParser

This commit is contained in:
Tomasz Sowa 2023-10-18 16:51:52 +02:00
parent e94589d6b5
commit 57f49cdcb6
Signed by: tomasz.sowa
GPG Key ID: 662CC1438638588B
1 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2012-2022, Tomasz Sowa
* Copyright (c) 2012-2023, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -691,7 +691,7 @@ void SpaceParser::parse_key_value_pairs(Space * space)
if( object_items_limit == 0 || !space->is_object() || (space->object_size() < object_items_limit) )
{
Space & new_space = space->add(token.c_str(), new Space());
Space & new_space = space->add_empty_space(token.c_str());
if( all_items_limit == 0 || current_items_counter++ < all_items_limit )
{
@ -762,11 +762,11 @@ void SpaceParser::parse_values_list(Space * space)
{
if( table_items_limit == 0 || !space->is_table() || (space->table_size() < table_items_limit) )
{
Space * new_space = &space->add(new Space());
Space & new_space = space->add_empty_space();
if( all_items_limit == 0 || current_items_counter++ < all_items_limit )
{
parse(new_space, false, true);
parse(&new_space, false, true);
}
else
{