From 46e9a8998e29cbf357b79123934434b2ea081e4b Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Tue, 9 Feb 2016 06:13:36 -0500 Subject: Avoid Coverity false positive It assumes unpoison is expecting a pointer to T and sizeof(T), but the sizeof is evaluated in unpoison but only in the case of building with valgrind. Just call the valgrind API again directly --- src/lib/utils/ct_utils.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/utils/ct_utils.h b/src/lib/utils/ct_utils.h index a10e242a6..3d0d1ac86 100644 --- a/src/lib/utils/ct_utils.h +++ b/src/lib/utils/ct_utils.h @@ -67,7 +67,11 @@ inline void unpoison(const T* p, size_t n) template inline void unpoison(T& p) { - unpoison(&p, 1); +#if defined(BOTAN_HAS_VALGRIND) + VALGRIND_MAKE_MEM_DEFINED(p, sizeof(T)); +#else + BOTAN_UNUSED(p); +#endif } /* -- cgit v1.2.3