Skip to content

Commit 37dd3cf

Browse files
midenokvuvova
authored andcommitted
MDEV-13550 Copy ctor instread of memcpy() in partition_info::get_clone() (#436)
List<>::last is wrong after memcpy(). Doing it on constructed objects is bad practice.
1 parent 3422ceb commit 37dd3cf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sql/partition_info.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,12 @@ partition_info *partition_info::get_clone(THD *thd)
4242

4343
List_iterator<partition_element> part_it(partitions);
4444
partition_element *part;
45-
partition_info *clone= new (mem_root) partition_info();
45+
partition_info *clone= new (mem_root) partition_info(*this);
4646
if (!clone)
4747
{
4848
mem_alloc_error(sizeof(partition_info));
4949
DBUG_RETURN(NULL);
5050
}
51-
memcpy(clone, this, sizeof(partition_info));
5251
memset(&(clone->read_partitions), 0, sizeof(clone->read_partitions));
5352
memset(&(clone->lock_partitions), 0, sizeof(clone->lock_partitions));
5453
clone->bitmaps_are_initialized= FALSE;

0 commit comments

Comments
 (0)