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
02d4647c
Commit
02d4647c
authored
Dec 11, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Jan 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hhctrl: Handle memory allocation failure in SearchCHM_File (cppcheck).
parent
88a5c64b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
search.c
dlls/hhctrl.ocx/search.c
+8
-6
No files found.
dlls/hhctrl.ocx/search.c
View file @
02d4647c
...
...
@@ -72,7 +72,7 @@ static void fill_search_tree(HWND hwndList, SearchItem *item)
*/
static
WCHAR
*
SearchCHM_File
(
IStorage
*
pStorage
,
const
WCHAR
*
file
,
const
char
*
needle
)
{
char
*
buffer
=
malloc
(
BLOCK_SIZE
)
;
char
*
buffer
=
NULL
,
*
new_buffer
;
strbuf_t
content
,
node
,
node_name
;
IStream
*
temp_stream
=
NULL
;
DWORD
i
,
buffer_size
=
0
;
...
...
@@ -84,7 +84,7 @@ static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char *
hres
=
IStorage_OpenStream
(
pStorage
,
file
,
NULL
,
STGM_READ
,
0
,
&
temp_stream
);
if
(
FAILED
(
hres
))
{
FIXME
(
"Could not open '%s' stream: %08lx
\n
"
,
debugstr_w
(
file
),
hres
);
goto
cleanup
;
return
NULL
;
}
strbuf_init
(
&
node
);
...
...
@@ -110,7 +110,9 @@ static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char *
title
[
wlen
]
=
0
;
}
buffer
=
realloc
(
buffer
,
buffer_size
+
textlen
+
1
);
new_buffer
=
realloc
(
buffer
,
buffer_size
+
textlen
+
1
);
if
(
!
new_buffer
)
goto
cleanup
;
buffer
=
new_buffer
;
memcpy
(
&
buffer
[
buffer_size
],
text
,
textlen
);
buffer
[
buffer_size
+
textlen
]
=
'\0'
;
buffer_size
+=
textlen
;
...
...
@@ -130,14 +132,14 @@ static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char *
if
(
strstr
(
buffer
,
needle
))
found
=
TRUE
;
cleanup:
strbuf_free
(
&
node
);
strbuf_free
(
&
content
);
strbuf_free
(
&
node_name
);
cleanup:
free
(
buffer
);
if
(
temp_stream
)
IStream_Release
(
temp_stream
);
IStream_Release
(
temp_stream
);
if
(
!
found
)
{
free
(
title
);
...
...
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