Skip to content
Permalink
Browse files

MDEV-11707: Fix incorrect memset() for structures containing

dynamic class GenericPolicy<TTASEventMutex<GenericPolicy> >'; vtable

Instead using mem_heap_alloc and memset, use mem_heap_zalloc
directly.
  • Loading branch information...
janlindstrom committed Feb 6, 2017
1 parent ddf2fac commit e53dfb24be73a204b4ee8efee6c07e1b13200052
Showing with 8 additions and 10 deletions.
  1. +4 −5 storage/innobase/buf/buf0mtflu.cc
  2. +4 −5 storage/xtradb/buf/buf0mtflu.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (C) 2013, 2014, Fusion-io. All Rights Reserved.
Copyright (C) 2013, 2015, MariaDB Corporation. All Rights Reserved.
Copyright (C) 2013, 2017, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -486,14 +486,13 @@ buf_mtflu_handler_init(
mtflush_heap2 = mem_heap_create(0);
ut_a(mtflush_heap2 != NULL);

mtflush_ctx = (thread_sync_t *)mem_heap_alloc(mtflush_heap,
mtflush_ctx = (thread_sync_t *)mem_heap_zalloc(mtflush_heap,
sizeof(thread_sync_t));
memset(mtflush_ctx, 0, sizeof(thread_sync_t));

ut_a(mtflush_ctx != NULL);
mtflush_ctx->thread_data = (thread_data_t*)mem_heap_alloc(
mtflush_ctx->thread_data = (thread_data_t*)mem_heap_zalloc(
mtflush_heap, sizeof(thread_data_t) * n_threads);
ut_a(mtflush_ctx->thread_data);
memset(mtflush_ctx->thread_data, 0, sizeof(thread_data_t) * n_threads);

mtflush_ctx->n_threads = n_threads;
mtflush_ctx->wq = ib_wqueue_create();
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (C) 2013, 2014, Fusion-io. All Rights Reserved.
Copyright (C) 2013, 2015, MariaDB Corporation. All Rights Reserved.
Copyright (C) 2013, 2017, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -486,14 +486,13 @@ buf_mtflu_handler_init(
mtflush_heap2 = mem_heap_create(0);
ut_a(mtflush_heap2 != NULL);

mtflush_ctx = (thread_sync_t *)mem_heap_alloc(mtflush_heap,
mtflush_ctx = (thread_sync_t *)mem_heap_zalloc(mtflush_heap,
sizeof(thread_sync_t));
memset(mtflush_ctx, 0, sizeof(thread_sync_t));

ut_a(mtflush_ctx != NULL);
mtflush_ctx->thread_data = (thread_data_t*)mem_heap_alloc(
mtflush_ctx->thread_data = (thread_data_t*)mem_heap_zalloc(
mtflush_heap, sizeof(thread_data_t) * n_threads);
ut_a(mtflush_ctx->thread_data);
memset(mtflush_ctx->thread_data, 0, sizeof(thread_data_t) * n_threads);

mtflush_ctx->n_threads = n_threads;
mtflush_ctx->wq = ib_wqueue_create();

0 comments on commit e53dfb2

Please sign in to comment.
You can’t perform that action at this time.