[Tarantool-patches] [PATCH] sql: fix memleak during parsing
Nikita Pettik
korablev at tarantool.org
Thu Sep 24 16:12:06 MSK 2020
On 23 Sep 17:26, Roman Khabibov wrote:
> Fix a memory leak generated by allocation of indexes array of
> parser ephemeral space.
> ---
I'd fix a bit commit message:
Fix a memory leak during execution of CREATE TABLE statement:
indexes to be created are stored in space->index array, which in
turn is allocated using malloc, but is never freed.
LGTM otherwise.
> Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/sql-memleak
>
> P.S. It's really memleak, I checked with valgrind.
>
> src/box/sql/tokenize.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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);
> }
>
> /**
> --
> 2.24.3 (Apple Git-128)
>
More information about the Tarantool-patches
mailing list