[Tarantool-patches] [PATCH] sql: fix memleak during parsing

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Fri Sep 25 00:30:33 MSK 2020


Hi! Thanks for the patch!

> diff --git a/src/box/sql/tokenize.c b/src/box/sql/tokenize.c
> index 5404a78e9..6cf92b4f7 100644
> --- a/src/box/sql/tokenize.c
> +++ b/src/box/sql/tokenize.c
> @@ -447,6 +447,8 @@ parser_space_delete(struct sql *db, struct space *space)
>  	assert(space->def->opts.is_ephemeral);
>  	for (uint32_t i = 0; i < space->index_count; ++i)
>  		index_def_delete(space->index[i]->def);
> +	if (space->index_count != 0)
> +		free(space->index);

Why do you check for index_count != 0? free() works
fine on NULL, which is the case when index_count is 0.


More information about the Tarantool-patches mailing list