Skip to content

Commit

Permalink
Bug#32855925: SELECT #2 WILL BE DISPLAYED TWICE WHEN WE EXPLAIN THE SQL
Browse files Browse the repository at this point in the history
Post-push fix.

ASan reported memory leaks from some EXPLAIN tests, such as
main.explain_tree.

The reason was that the Json_dom objects that were discarded to avoid
describing a subquery twice, were not properly destroyed.

The EXPLAIN code uses unique_ptr to make sure the Json_dom objects are
destroyed, but there are windows in which the objects only exist as
unmanaged raw pointers. This patch closes the window which caused this
memory leak by changing ExplainChild::obj from a raw pointer to a
unique_ptr, so that it gets destroyed even if it doesn't make it into
the final tree that describes the full plan.

Change-Id: I0f0885da867e8a34335ff11f3ae9da883a878ba4
  • Loading branch information
kahatlen committed Oct 7, 2023
1 parent ab5d892 commit 094f236
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 101 deletions.
Loading

0 comments on commit 094f236

Please sign in to comment.