Commit 733bf916 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Simplify allocation code.

parent bc7e51b4
...@@ -400,17 +400,13 @@ static BOOL check_live_target(struct process* pcs, BOOL wow64, BOOL child_wow64) ...@@ -400,17 +400,13 @@ static BOOL check_live_target(struct process* pcs, BOOL wow64, BOOL child_wow64)
{ {
size_t buf_size = 0, i, last_null = -1; size_t buf_size = 0, i, last_null = -1;
WCHAR *buf = NULL; WCHAR *buf = NULL;
WCHAR *new_buf;
do do
{ {
size_t read_size = sysinfo.dwAllocationGranularity - (env & (sysinfo.dwAllocationGranularity - 1)); size_t read_size = sysinfo.dwAllocationGranularity - (env & (sysinfo.dwAllocationGranularity - 1));
if (buf) if (!(new_buf = realloc(buf, buf_size + read_size))) break;
{ buf = new_buf;
WCHAR *new_buf;
if (!(new_buf = realloc(buf, buf_size + read_size))) break;
buf = new_buf;
}
else if(!(buf = malloc(read_size))) break;
if (!read_process_memory(pcs, env, (char*)buf + buf_size, read_size)) break; if (!read_process_memory(pcs, env, (char*)buf + buf_size, read_size)) break;
for (i = buf_size / sizeof(WCHAR); i < (buf_size + read_size) / sizeof(WCHAR); i++) for (i = buf_size / sizeof(WCHAR); i < (buf_size + read_size) / sizeof(WCHAR); i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment