Skip to content

Commit e53dfb2

Browse files
author
Jan Lindström
committed
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.
1 parent ddf2fac commit e53dfb2

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

storage/innobase/buf/buf0mtflu.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (C) 2013, 2014, Fusion-io. All Rights Reserved.
4-
Copyright (C) 2013, 2015, MariaDB Corporation. All Rights Reserved.
4+
Copyright (C) 2013, 2017, MariaDB Corporation. All Rights Reserved.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -486,14 +486,13 @@ buf_mtflu_handler_init(
486486
mtflush_heap2 = mem_heap_create(0);
487487
ut_a(mtflush_heap2 != NULL);
488488

489-
mtflush_ctx = (thread_sync_t *)mem_heap_alloc(mtflush_heap,
489+
mtflush_ctx = (thread_sync_t *)mem_heap_zalloc(mtflush_heap,
490490
sizeof(thread_sync_t));
491-
memset(mtflush_ctx, 0, sizeof(thread_sync_t));
491+
492492
ut_a(mtflush_ctx != NULL);
493-
mtflush_ctx->thread_data = (thread_data_t*)mem_heap_alloc(
493+
mtflush_ctx->thread_data = (thread_data_t*)mem_heap_zalloc(
494494
mtflush_heap, sizeof(thread_data_t) * n_threads);
495495
ut_a(mtflush_ctx->thread_data);
496-
memset(mtflush_ctx->thread_data, 0, sizeof(thread_data_t) * n_threads);
497496

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

storage/xtradb/buf/buf0mtflu.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (C) 2013, 2014, Fusion-io. All Rights Reserved.
4-
Copyright (C) 2013, 2015, MariaDB Corporation. All Rights Reserved.
4+
Copyright (C) 2013, 2017, MariaDB Corporation. All Rights Reserved.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -486,14 +486,13 @@ buf_mtflu_handler_init(
486486
mtflush_heap2 = mem_heap_create(0);
487487
ut_a(mtflush_heap2 != NULL);
488488

489-
mtflush_ctx = (thread_sync_t *)mem_heap_alloc(mtflush_heap,
489+
mtflush_ctx = (thread_sync_t *)mem_heap_zalloc(mtflush_heap,
490490
sizeof(thread_sync_t));
491-
memset(mtflush_ctx, 0, sizeof(thread_sync_t));
491+
492492
ut_a(mtflush_ctx != NULL);
493-
mtflush_ctx->thread_data = (thread_data_t*)mem_heap_alloc(
493+
mtflush_ctx->thread_data = (thread_data_t*)mem_heap_zalloc(
494494
mtflush_heap, sizeof(thread_data_t) * n_threads);
495495
ut_a(mtflush_ctx->thread_data);
496-
memset(mtflush_ctx->thread_data, 0, sizeof(thread_data_t) * n_threads);
497496

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

0 commit comments

Comments
 (0)