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
ad531404
Commit
ad531404
authored
Nov 27, 2018
by
Zebediah Figura
Committed by
Alexandre Julliard
Nov 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Avoid unnecessary buffer allocation in SetupDiCreateDeviceInfoA().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8289c651
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
8 deletions
+3
-8
devinst.c
dlls/setupapi/devinst.c
+3
-8
No files found.
dlls/setupapi/devinst.c
View file @
ad531404
...
...
@@ -1341,8 +1341,8 @@ BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, const char *name,
const
GUID
*
ClassGuid
,
PCSTR
DeviceDescription
,
HWND
hwndParent
,
DWORD
CreationFlags
,
PSP_DEVINFO_DATA
DeviceInfoData
)
{
WCHAR
nameW
[
MAX_DEVICE_ID_LEN
];
BOOL
ret
=
FALSE
;
LPWSTR
DeviceNameW
=
NULL
;
LPWSTR
DeviceDescriptionW
=
NULL
;
if
(
!
name
||
strlen
(
name
)
>=
MAX_DEVICE_ID_LEN
)
...
...
@@ -1351,23 +1351,18 @@ BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO DeviceInfoSet, const char *name,
return
FALSE
;
}
DeviceNameW
=
MultiByteToUnicode
(
name
,
CP_ACP
);
if
(
DeviceNameW
==
NULL
)
return
FALSE
;
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
nameW
,
sizeof
(
nameW
));
if
(
DeviceDescription
)
{
DeviceDescriptionW
=
MultiByteToUnicode
(
DeviceDescription
,
CP_ACP
);
if
(
DeviceDescriptionW
==
NULL
)
{
MyFree
(
DeviceNameW
);
return
FALSE
;
}
}
ret
=
SetupDiCreateDeviceInfoW
(
DeviceInfoSet
,
DeviceN
ameW
,
ClassGuid
,
DeviceDescriptionW
,
ret
=
SetupDiCreateDeviceInfoW
(
DeviceInfoSet
,
n
ameW
,
ClassGuid
,
DeviceDescriptionW
,
hwndParent
,
CreationFlags
,
DeviceInfoData
);
MyFree
(
DeviceNameW
);
MyFree
(
DeviceDescriptionW
);
return
ret
;
...
...
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