aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-02-09 06:13:36 -0500
committerJack Lloyd <[email protected]>2016-02-09 06:13:36 -0500
commit46e9a8998e29cbf357b79123934434b2ea081e4b (patch)
treec6a5779ca1465cea8c4f492780d34d998f01cbb9
parent8adb9e27f10c50c76d5b42fb1ccc6b5cd3224026 (diff)
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
-rw-r--r--src/lib/utils/ct_utils.h6
1 files changed, 5 insertions, 1 deletions
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<typename T>
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
}
/*