DRAFT: MCOL-6432 Fix ASan-detected memory leaks on the ColumnStore DDL path#4031
DRAFT: MCOL-6432 Fix ASan-detected memory leaks on the ColumnStore DDL path#4031mariadb-VasilyKozhukhovskiy wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates dbcon/mysql/ha_mcs_ddl.cpp to use modern C++ memory management. Specifically, it replaces a raw pointer rowgroup::RowGroup* with a std::unique_ptr<rowgroup::RowGroup> and utilizes std::make_unique for instantiation, ensuring safer memory handling. There are no review comments, and we have no additional feedback to provide.
b0b6419 to
e2061fd
Compare
e2061fd to
a599432
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request improves memory management by cleaning up allocated members in the AtaRenameColumn destructor and replacing a raw pointer with std::unique_ptr in ha_mcs_ddl.cpp. The review feedback suggests utilizing a range-based for loop in the destructor of AtaRenameColumn for cleaner C++ code, and wrapping constraint_list in a std::unique_ptr to guarantee exception safety during assignment.
| ColumnConstraintList::iterator itr; | ||
|
|
||
| for (itr = fConstraints.begin(); itr != fConstraints.end(); ++itr) | ||
| { | ||
| delete *itr; | ||
| } |
| { | ||
| fConstraints = *constraint_list; | ||
| delete constraint_list; // fConstraints now owns the element pointers; free the redundant list | ||
| // container the parser allocated (mirrors ColumnDef's constructor). | ||
| } |
There was a problem hiding this comment.
If fConstraints = *constraint_list; throws an exception (such as std::bad_alloc during container copy), the delete constraint_list; statement will be bypassed, resulting in a memory leak of the constraint_list container. Wrapping the raw pointer in a std::unique_ptr immediately ensures exception-safe cleanup.
{
std::unique_ptr<ColumnConstraintList> auto_delete(constraint_list);
fConstraints = *auto_delete;
}…d the regression (2)
…evert before merge
No description provided.