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
e7ea8380
Commit
e7ea8380
authored
Aug 01, 2017
by
Hugh McMaster
Committed by
Alexandre Julliard
Aug 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg: Use a helper function to resize a memory buffer.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a1bc33ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
reg.c
programs/reg/reg.c
+21
-3
No files found.
programs/reg/reg.c
View file @
e7ea8380
...
@@ -90,6 +90,24 @@ static void *heap_xalloc(size_t size)
...
@@ -90,6 +90,24 @@ static void *heap_xalloc(size_t size)
return
buf
;
return
buf
;
}
}
static
void
*
heap_xrealloc
(
void
*
buf
,
size_t
size
)
{
void
*
new_buf
;
if
(
buf
)
new_buf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
buf
,
size
);
else
new_buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
new_buf
)
{
ERR
(
"Out of memory!
\n
"
);
exit
(
1
);
}
return
new_buf
;
}
static
BOOL
heap_free
(
void
*
buf
)
static
BOOL
heap_free
(
void
*
buf
)
{
{
return
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
return
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
...
@@ -662,7 +680,7 @@ static int query_value(HKEY key, WCHAR *value_name, WCHAR *path, BOOL recurse)
...
@@ -662,7 +680,7 @@ static int query_value(HKEY key, WCHAR *value_name, WCHAR *path, BOOL recurse)
if
(
rc
==
ERROR_MORE_DATA
)
if
(
rc
==
ERROR_MORE_DATA
)
{
{
max_data_bytes
=
data_size
;
max_data_bytes
=
data_size
;
data
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
data
,
max_data_bytes
);
data
=
heap_xrealloc
(
data
,
max_data_bytes
);
}
}
else
break
;
else
break
;
}
}
...
@@ -754,12 +772,12 @@ static int query_all(HKEY key, WCHAR *path, BOOL recurse)
...
@@ -754,12 +772,12 @@ static int query_all(HKEY key, WCHAR *path, BOOL recurse)
if
(
data_size
>
max_data_bytes
)
if
(
data_size
>
max_data_bytes
)
{
{
max_data_bytes
=
data_size
;
max_data_bytes
=
data_size
;
data
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
data
,
max_data_bytes
);
data
=
heap_xrealloc
(
data
,
max_data_bytes
);
}
}
else
else
{
{
max_value_len
*=
2
;
max_value_len
*=
2
;
value_name
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
value_name
,
max_value_len
*
sizeof
(
WCHAR
));
value_name
=
heap_xrealloc
(
value_name
,
max_value_len
*
sizeof
(
WCHAR
));
}
}
}
}
else
break
;
else
break
;
...
...
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