packet_realloc() does not return on error, so we can use NULL for normal circumstances.
Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com --- programs/winedbg/gdbproxy.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index deb6b0973f5..3f5584633e4 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -707,6 +707,12 @@ enum packet_return {packet_error = 0x00, packet_ok = 0x01, packet_done = 0x02,
static char* packet_realloc(char* buf, int size) { + if (!size) + { + if (buf) + HeapFree(GetProcessHeap(), 0, buf); + return NULL; + } if (!buf) return HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, size); return HeapReAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, buf, size);