[PATCH v3 1/9] winedbg: Crash when allocation fails in packet_realloc().
Jinoh Kang
jinoh.kang.kr at gmail.com
Tue Nov 16 10:51:00 CST 2021
Today, every caller of packet_realloc simply assumes that the allocation
always succeeds. Not crashing outright on allocation failure makes
diagnosing problems more difficult.
Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
programs/winedbg/gdbproxy.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 522e4fdb506..deb6b0973f5 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -708,9 +708,8 @@ enum packet_return {packet_error = 0x00, packet_ok = 0x01, packet_done = 0x02,
static char* packet_realloc(char* buf, int size)
{
if (!buf)
- return HeapAlloc(GetProcessHeap(), 0, size);
- return HeapReAlloc(GetProcessHeap(), 0, buf, size);
-
+ return HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, size);
+ return HeapReAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, buf, size);
}
static void packet_reply_grow(struct gdb_context* gdbctx, size_t size)
--
2.31.1
More information about the wine-devel
mailing list