Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1b3afb27
Commit
1b3afb27
authored
Jul 27, 2017
by
Hugh McMaster
Committed by
Alexandre Julliard
Jul 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Use heap_xrealloc() for consistency.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f7bdf340
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
regproc.c
programs/regedit/regproc.c
+23
-22
No files found.
programs/regedit/regproc.c
View file @
1b3afb27
...
...
@@ -55,6 +55,24 @@ static void *heap_xalloc(size_t size)
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
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
...
...
@@ -226,19 +244,6 @@ static inline enum parser_state set_state(struct parser *parser, enum parser_sta
return
ret
;
}
static
void
*
resize_buffer
(
void
*
buf
,
size_t
count
)
{
void
*
new_buf
;
if
(
buf
)
new_buf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
buf
,
count
);
else
new_buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
);
CHECK_ENOUGH_MEMORY
(
new_buf
);
return
new_buf
;
}
/******************************************************************************
* Converts a hex representation of a DWORD into a DWORD.
*/
...
...
@@ -286,7 +291,7 @@ static BOOL convert_hex_csv_to_hex(struct parser *parser, WCHAR **str)
/* The worst case is 1 digit + 1 comma per byte */
size
=
((
lstrlenW
(
*
str
)
+
1
)
/
2
)
+
parser
->
data_size
;
parser
->
data
=
resize_buffer
(
parser
->
data
,
size
);
parser
->
data
=
heap_xrealloc
(
parser
->
data
,
size
);
s
=
*
str
;
d
=
(
BYTE
*
)
parser
->
data
+
parser
->
data_size
;
...
...
@@ -985,10 +990,8 @@ static WCHAR *get_lineA(FILE *fp)
memmove
(
buf
,
next
,
len
+
1
);
if
(
size
-
len
<
3
)
{
char
*
new_buf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
buf
,
size
*
2
);
CHECK_ENOUGH_MEMORY
(
new_buf
);
buf
=
new_buf
;
size
*=
2
;
buf
=
heap_xrealloc
(
buf
,
size
);
}
if
(
!
(
count
=
fread
(
buf
+
len
,
1
,
size
-
len
-
1
,
fp
)))
{
...
...
@@ -1043,10 +1046,8 @@ static WCHAR *get_lineW(FILE *fp)
memmove
(
buf
,
next
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
size
-
len
<
3
)
{
WCHAR
*
new_buf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
buf
,
(
size
*
2
)
*
sizeof
(
WCHAR
));
CHECK_ENOUGH_MEMORY
(
new_buf
);
buf
=
new_buf
;
size
*=
2
;
buf
=
heap_xrealloc
(
buf
,
size
*
sizeof
(
WCHAR
));
}
if
(
!
(
count
=
fread
(
buf
+
len
,
sizeof
(
WCHAR
),
size
-
len
-
1
,
fp
)))
{
...
...
@@ -1396,12 +1397,12 @@ static int export_registry_data(FILE *fp, HKEY key, WCHAR *path, BOOL unicode)
if
(
data_size
>
max_data_bytes
)
{
max_data_bytes
=
data_size
;
data
=
resize_buffer
(
data
,
max_data_bytes
);
data
=
heap_xrealloc
(
data
,
max_data_bytes
);
}
else
{
max_value_len
*=
2
;
value_name
=
resize_buffer
(
value_name
,
max_value_len
*
sizeof
(
WCHAR
));
value_name
=
heap_xrealloc
(
value_name
,
max_value_len
*
sizeof
(
WCHAR
));
}
}
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