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
7ebb621e
Commit
7ebb621e
authored
Dec 11, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Jan 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Handle memory allocation failure in Dde_OnRequest (cppcheck).
parent
32bfaeb3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
dde.c
dlls/shell32/dde.c
+15
-5
No files found.
dlls/shell32/dde.c
View file @
7ebb621e
...
...
@@ -145,9 +145,9 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
WIN32_FIND_DATAW
finddata
;
HANDLE
hfind
;
int
len
=
1
;
WCHAR
*
groups_data
=
malloc
(
sizeof
(
WCHAR
));
WCHAR
*
groups_data
=
malloc
(
sizeof
(
WCHAR
))
,
*
new_groups_data
;
char
*
groups_dataA
;
HDDEDATA
ret
;
HDDEDATA
ret
=
NULL
;
groups_data
[
0
]
=
0
;
programs
=
get_programs_path
(
L"*"
,
FALSE
);
...
...
@@ -160,7 +160,14 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
wcscmp
(
finddata
.
cFileName
,
L"."
)
&&
wcscmp
(
finddata
.
cFileName
,
L".."
))
{
len
+=
lstrlenW
(
finddata
.
cFileName
)
+
2
;
groups_data
=
realloc
(
groups_data
,
len
*
sizeof
(
WCHAR
));
new_groups_data
=
realloc
(
groups_data
,
len
*
sizeof
(
WCHAR
));
if
(
!
new_groups_data
)
{
free
(
groups_data
);
free
(
programs
);
return
NULL
;
}
groups_data
=
new_groups_data
;
lstrcatW
(
groups_data
,
finddata
.
cFileName
);
lstrcatW
(
groups_data
,
L"
\r\n
"
);
}
...
...
@@ -170,8 +177,11 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
groups_data
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
groups_dataA
=
malloc
(
len
*
sizeof
(
WCHAR
));
WideCharToMultiByte
(
CP_ACP
,
0
,
groups_data
,
-
1
,
groups_dataA
,
len
,
NULL
,
NULL
);
ret
=
DdeCreateDataHandle
(
dwDDEInst
,
(
BYTE
*
)
groups_dataA
,
len
,
0
,
hszGroups
,
uFmt
,
0
);
if
(
groups_dataA
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
groups_data
,
-
1
,
groups_dataA
,
len
,
NULL
,
NULL
);
ret
=
DdeCreateDataHandle
(
dwDDEInst
,
(
BYTE
*
)
groups_dataA
,
len
,
0
,
hszGroups
,
uFmt
,
0
);
}
free
(
groups_dataA
);
free
(
groups_data
);
...
...
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