Skip to content

MDEV-38004 Double free on re-execution of prepared aggregate function - #5635

Open
KhaledR57 wants to merge 1 commit into
10.11from
10.11-MDEV-38004
Open

MDEV-38004 Double free on re-execution of prepared aggregate function#5635
KhaledR57 wants to merge 1 commit into
10.11from
10.11-MDEV-38004

Conversation

@KhaledR57

Copy link
Copy Markdown
Contributor

Between two executions of a prepared statement, Item_sp::cleanup() freed the stored function's memory root but left the arena's free list pointing into it. That list is filled when the function call returns and the active arena is restored.

On the next execution Item_sum_sp::clear() walked the stale list and destroyed already freed items.

Free the items before freeing the memory they live in, the order Item_sum_sp::clear() already uses.

Between two executions of a prepared statement, Item_sp::cleanup() freed
the stored function's memory root but left the arena's free list pointing
into it. That list is filled when the function call returns and the active
arena is restored.

On the next execution Item_sum_sp::clear() walked the stale list and
destroyed already freed items.

Free the items before freeing the memory they live in, the order
Item_sum_sp::clear() already uses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant