From 8654f36e2016bc27d7a30b1b914edd9b5d1a3019 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 14 Jun 2019 17:51:14 +0200 Subject: [PATCH] Check for LocalAlloc() failure in Release builds too Signed-off-by: Simon Rozman --- include/WinStd/Crypt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/WinStd/Crypt.h b/include/WinStd/Crypt.h index f8e55cbf..9ee1c8c4 100644 --- a/include/WinStd/Crypt.h +++ b/include/WinStd/Crypt.h @@ -612,7 +612,7 @@ namespace winstd cbData = other.cbData; if (cbData) { pbData = (BYTE*)LocalAlloc(LMEM_FIXED, other.cbData); - assert(pbData); + if (!pbData) throw win_runtime_error("LocalAlloc failed."); memcpy(pbData, other.pbData, other.cbData); } else pbData = NULL; @@ -645,7 +645,7 @@ namespace winstd LocalFree(pbData); if (cbData) { pbData = (BYTE*)LocalAlloc(LMEM_FIXED, other.cbData); - assert(pbData); + if (!pbData) throw win_runtime_error("LocalAlloc failed."); memcpy(pbData, other.pbData, other.cbData); } else pbData = NULL;