Skip to content

Commit ddd5449

Browse files
[fixup] post-merge spider fixup
MDEV-32524: a couple missed magic numbers MDEV-26247: a couple missed goto statements that could lead to memory leak
1 parent b97f4c3 commit ddd5449

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

storage/spider/spd_db_conn.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4786,7 +4786,7 @@ int spider_db_store_result_for_reuse_cursor(
47864786
THD *thd = current_thd;
47874787
char buf[MAX_FIELD_WIDTH];
47884788
spider_string tmp_str(buf, MAX_FIELD_WIDTH, &my_charset_bin);
4789-
tmp_str.init_calc_mem(120);
4789+
tmp_str.init_calc_mem(SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_1);
47904790

47914791
DBUG_PRINT("info",("spider store result to temporary table"));
47924792
DBUG_ASSERT(!current->result_tmp_tbl);

storage/spider/spd_db_mysql.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3364,7 +3364,7 @@ int spider_db_mbase::set_loop_check(
33643364
spider_string sql_str(sql_buf, sizeof(sql_buf), &my_charset_bin);
33653365
DBUG_ENTER("spider_db_mbase::set_loop_check");
33663366
DBUG_PRINT("info",("spider this=%p", this));
3367-
sql_str.init_calc_mem(270);
3367+
sql_str.init_calc_mem(SPD_MID_DB_MBASE_SET_LOOP_CHECK_1);
33683368
while ((lcptr = (SPIDER_CONN_LOOP_CHECK *) my_hash_element(
33693369
&conn->loop_check_queue, 0)))
33703370
{

storage/spider/spd_group_by_handler.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,8 +1719,7 @@ group_by_handler *spider_create_group_by_handler(
17191719
if (spider->dml_init())
17201720
{
17211721
DBUG_PRINT("info",("spider can not init for dml"));
1722-
delete fields;
1723-
DBUG_RETURN(NULL);
1722+
goto skip_free_fields;
17241723
}
17251724
for (
17261725
roop_count = spider_conn_link_idx_next(share->link_statuses,
@@ -1792,8 +1791,7 @@ group_by_handler *spider_create_group_by_handler(
17921791
if (spider->dml_init())
17931792
{
17941793
DBUG_PRINT("info",("spider can not init for dml"));
1795-
delete fields;
1796-
DBUG_RETURN(NULL);
1794+
goto skip_free_fields;
17971795
}
17981796
for (
17991797
roop_count = spider_conn_link_idx_next(share->link_statuses,

storage/spider/spd_include.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ enum spider_malloc_id {
377377
SPD_MID_DB_MBASE_RESULT_FETCH_ROW_FROM_TMP_TABLE_3,
378378
SPD_MID_DB_MBASE_ROW_APPEND_ESCAPED_TO_STR_1,
379379
SPD_MID_DB_MBASE_ROW_CLONE_1,
380+
SPD_MID_DB_MBASE_SET_LOOP_CHECK_1,
380381
SPD_MID_DB_MBASE_SET_SQL_MODE_1,
381382
SPD_MID_DB_MBASE_SET_TIME_ZONE_1,
382383
SPD_MID_DB_MBASE_SET_WAIT_TIMEOUT_1,
@@ -412,6 +413,7 @@ enum spider_malloc_id {
412413
SPD_MID_DB_STORE_RESULT_3,
413414
SPD_MID_DB_STORE_RESULT_4,
414415
SPD_MID_DB_STORE_RESULT_5,
416+
SPD_MID_DB_STORE_RESULT_FOR_REUSE_CURSOR_1,
415417
SPD_MID_DB_UDF_COPY_TABLES_1,
416418
SPD_MID_DB_UDF_PING_TABLE_1,
417419
SPD_MID_DB_UDF_PING_TABLE_2,

0 commit comments

Comments
 (0)