From fef90d2a3c4f40950651e794c8e5c07d98049e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Fri, 25 Mar 2022 13:24:58 +0300 Subject: [PATCH] mdbx: add explicit `memset()` for debugging. --- src/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core.c b/src/core.c index 0463a2fa..3a3a0bf3 100644 --- a/src/core.c +++ b/src/core.c @@ -7281,6 +7281,10 @@ static int mdbx_cursor_shadow(MDBX_txn *parent, MDBX_txn *nested) { bk = mdbx_malloc(size); if (unlikely(!bk)) return MDBX_ENOMEM; +#if MDBX_DEBUG + memset(bk, 0xCD, size); + VALGRIND_MAKE_MEM_UNDEFINED(bk, size); +#endif /* MDBX_DEBUG */ *bk = *mc; mc->mc_backup = bk; /* Kill pointers into src to reduce abuse: The @@ -8137,6 +8141,10 @@ int mdbx_txn_begin_ex(MDBX_env *env, MDBX_txn *parent, MDBX_txn_flags_t flags, mdbx_debug("calloc: %s", "failed"); return MDBX_ENOMEM; } +#if MDBX_DEBUG + memset(txn, 0xCD, size); + VALGRIND_MAKE_MEM_UNDEFINED(txn, size); +#endif /* MDBX_DEBUG */ memset(txn, 0, tsize); txn->mt_dbxs = env->me_dbxs; /* static */ txn->mt_dbs = (MDBX_db *)((char *)txn + tsize);