From dbf7efde1e04ac0ff445f64438078d87eb035b68 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 26 May 2016 17:22:34 +0200 Subject: V4: Mirror jsAlloc behavior at stack allocation. Allocating from the JS stack will zero out the memory, and thus indicate to valgrind that memory is not uninitialized. By first marking the whole stack as uninitialized and only then allocating 2 entries, the behavior for those two entries will now match the allocation behavior. This fixes a false positive when using valgrind. Change-Id: Icdb5279e1cfbfe6b5c385cc42c556edf721fa74b Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4scopedvalue_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4scopedvalue_p.h') diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index d7fd44e1d6..ca7efb1e79 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -82,7 +82,7 @@ struct Scope { memset(mark, 0, (engine->jsStackTop - mark)*sizeof(Value)); #endif #ifdef V4_USE_VALGRIND - VALGRIND_MAKE_MEM_UNDEFINED(mark, engine->jsStackLimit - mark); + VALGRIND_MAKE_MEM_UNDEFINED(mark, (engine->jsStackLimit - mark) * sizeof(Value)); #endif engine->jsStackTop = mark; } -- cgit v1.2.3