Skip to content
Permalink
Browse files
MDEV-13550 Copy ctor instread of memcpy() in partition_info::get_clon…
…e() (#436)

List<>::last is wrong after memcpy(). Doing it on constructed objects is bad practice.
  • Loading branch information
midenok authored and vuvova committed Nov 22, 2017
1 parent 3422ceb commit 37dd3cf
Showing 1 changed file with 1 addition and 2 deletions.
@@ -42,13 +42,12 @@ partition_info *partition_info::get_clone(THD *thd)

List_iterator<partition_element> part_it(partitions);
partition_element *part;
partition_info *clone= new (mem_root) partition_info();
partition_info *clone= new (mem_root) partition_info(*this);
if (!clone)
{
mem_alloc_error(sizeof(partition_info));
DBUG_RETURN(NULL);
}
memcpy(clone, this, sizeof(partition_info));
memset(&(clone->read_partitions), 0, sizeof(clone->read_partitions));
memset(&(clone->lock_partitions), 0, sizeof(clone->lock_partitions));
clone->bitmaps_are_initialized= FALSE;

0 comments on commit 37dd3cf

Please sign in to comment.