There's a change in __wt_scr_discard to complain if a scratch buffer isn't discarded cleanly, that is, if we're discarding a scratch buffer where its in-use flag wasn't cleared.
Turning the change on breaks the test suite, we need to find/fix those problems and then leave the diagnostic on.
/*
* __wt_scr_discard --
* Free all memory associated with the scratch buffers.
*/
void
__wt_scr_discard(WT_SESSION_IMPL *session)
{
WT_ITEM **bufp;
u_int i;
for (i = 0,
bufp = session->scratch; i < session->scratch_alloc; ++i, ++bufp) {
if (*bufp == NULL)
continue;
#if 0
if (F_ISSET(*bufp, WT_ITEM_INUSE))
__wt_errx(session,
"scratch buffer allocated and never discarded");
#endif
__wt_buf_free(session, *bufp);
__wt_free(session, *bufp);
}
__wt_free(session, session->scratch);
}