You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
chore(MCOL-6018) Fix leaks in Columnstore information tables
Fix introduces unique_ptr around DBRM instance in fill result functions. Now all paths lead to DBRM instance freeing.
This commit is contained in:
committed by
Leonid Fedorov
parent
7171742dab
commit
6e3cf16ce4
@@ -202,7 +202,7 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
TABLE* table = tables->table;
|
TABLE* table = tables->table;
|
||||||
|
|
||||||
BRM::DBRM::refreshShmWithLock();
|
BRM::DBRM::refreshShmWithLock();
|
||||||
BRM::DBRM* emp = new BRM::DBRM();
|
std::unique_ptr<BRM::DBRM> emp(new BRM::DBRM());
|
||||||
|
|
||||||
if (!emp || !emp->isDBRMReady())
|
if (!emp || !emp->isDBRMReady())
|
||||||
{
|
{
|
||||||
@@ -224,7 +224,7 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
|
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
|
||||||
{
|
{
|
||||||
cond_oid = fitem->arguments()[1]->val_int();
|
cond_oid = fitem->arguments()[1]->val_int();
|
||||||
return generate_result(cond_oid, emp, table, thd);
|
return generate_result(cond_oid, emp.get(), table, thd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fitem->arguments()[1]->real_item()->type() == Item::FIELD_ITEM &&
|
else if (fitem->arguments()[1]->real_item()->type() == Item::FIELD_ITEM &&
|
||||||
@@ -236,7 +236,7 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
|
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
|
||||||
{
|
{
|
||||||
cond_oid = fitem->arguments()[0]->val_int();
|
cond_oid = fitem->arguments()[0]->val_int();
|
||||||
return generate_result(cond_oid, emp, table, thd);
|
return generate_result(cond_oid, emp.get(), table, thd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,7 +250,7 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
for (unsigned int i = 1; i < fitem->argument_count(); i++)
|
for (unsigned int i = 1; i < fitem->argument_count(); i++)
|
||||||
{
|
{
|
||||||
cond_oid = fitem->arguments()[i]->val_int();
|
cond_oid = fitem->arguments()[i]->val_int();
|
||||||
int result = generate_result(cond_oid, emp, table, thd);
|
int result = generate_result(cond_oid, emp.get(), table, thd);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -266,7 +266,7 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
|
|
||||||
while (ss >> cond_oid)
|
while (ss >> cond_oid)
|
||||||
{
|
{
|
||||||
int ret = generate_result(cond_oid, emp, table, thd);
|
int ret = generate_result(cond_oid, emp.get(), table, thd);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -282,7 +282,7 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
|
|
||||||
for (BRM::OID_t oid = 3000; oid <= MaxOID; oid++)
|
for (BRM::OID_t oid = 3000; oid <= MaxOID; oid++)
|
||||||
{
|
{
|
||||||
int result = generate_result(oid, emp, table, thd);
|
int result = generate_result(oid, emp.get(), table, thd);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -216,7 +216,7 @@ static int generate_result(BRM::OID_t oid, BRM::DBRM* emp, TABLE* table, THD* th
|
|||||||
static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
||||||
{
|
{
|
||||||
BRM::DBRM::refreshShmWithLock();
|
BRM::DBRM::refreshShmWithLock();
|
||||||
BRM::DBRM* emp = new BRM::DBRM();
|
std::unique_ptr<BRM::DBRM> emp(new BRM::DBRM());
|
||||||
BRM::OID_t cond_oid = 0;
|
BRM::OID_t cond_oid = 0;
|
||||||
TABLE* table = tables->table;
|
TABLE* table = tables->table;
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
|
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
|
||||||
{
|
{
|
||||||
cond_oid = fitem->arguments()[1]->val_int();
|
cond_oid = fitem->arguments()[1]->val_int();
|
||||||
return generate_result(cond_oid, emp, table, thd);
|
return generate_result(cond_oid, emp.get(), table, thd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fitem->arguments()[1]->real_item()->type() == Item::FIELD_ITEM &&
|
else if (fitem->arguments()[1]->real_item()->type() == Item::FIELD_ITEM &&
|
||||||
@@ -252,7 +252,7 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
|
if (strcasecmp(item_field->field_name.str, "object_id") == 0)
|
||||||
{
|
{
|
||||||
cond_oid = fitem->arguments()[0]->val_int();
|
cond_oid = fitem->arguments()[0]->val_int();
|
||||||
return generate_result(cond_oid, emp, table, thd);
|
return generate_result(cond_oid, emp.get(), table, thd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,7 +266,7 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
for (unsigned int i = 1; i < fitem->argument_count(); i++)
|
for (unsigned int i = 1; i < fitem->argument_count(); i++)
|
||||||
{
|
{
|
||||||
cond_oid = fitem->arguments()[i]->val_int();
|
cond_oid = fitem->arguments()[i]->val_int();
|
||||||
int result = generate_result(cond_oid, emp, table, thd);
|
int result = generate_result(cond_oid, emp.get(), table, thd);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -282,7 +282,7 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
|
|
||||||
while (ss >> cond_oid)
|
while (ss >> cond_oid)
|
||||||
{
|
{
|
||||||
int ret = generate_result(cond_oid, emp, table, thd);
|
int ret = generate_result(cond_oid, emp.get(), table, thd);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -300,14 +300,13 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond)
|
|||||||
{
|
{
|
||||||
for (BRM::OID_t oid = 3000; oid <= MaxOID; oid++)
|
for (BRM::OID_t oid = 3000; oid <= MaxOID; oid++)
|
||||||
{
|
{
|
||||||
int result = generate_result(oid, emp, table, thd);
|
int result = generate_result(oid, emp.get(), table, thd);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete emp;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user