Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
218d970b
Commit
218d970b
authored
May 18, 2011
by
Andrew Nguyen
Committed by
Alexandre Julliard
May 18, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Eliminate a possible memory leak in input_fetch_entire_line.
parent
99819384
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
dbg.y
programs/winedbg/dbg.y
+11
-14
No files found.
programs/winedbg/dbg.y
View file @
218d970b
...
...
@@ -462,42 +462,39 @@ static HANDLE dbg_parser_output;
int input_fetch_entire_line(const char* pfx, char** line)
{
char* buffer;
char ch;
DWORD nread;
size_t len, alloc;
/* as of today, console handles can be file handles... so better use file APIs rather than
* console's
*/
WriteFile(dbg_parser_output, pfx, strlen(pfx), &nread, NULL);
if (*line)
{
alloc = HeapSize(GetProcessHeap(), 0, *line);
assert(alloc);
}
else
{
*line = HeapAlloc(GetProcessHeap(), 0, alloc = 16);
assert(*line);
}
buffer = HeapAlloc(GetProcessHeap(), 0, alloc = 16);
assert(buffer != NULL);
len = 0;
do
{
if (!ReadFile(dbg_parser_input, &ch, 1, &nread, NULL) || nread == 0)
{
HeapFree(GetProcessHeap(), 0, buffer);
return -1;
}
if (len + 2 > alloc)
{
while (len + 2 > alloc) alloc *= 2;
*line = dbg_heap_realloc(*line
, alloc);
buffer = dbg_heap_realloc(buffer
, alloc);
}
(*line)
[len++] = ch;
buffer
[len++] = ch;
}
while (ch != '\n');
(*line)
[len] = '\0';
buffer
[len] = '\0';
*line = buffer;
return len;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment