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
19015ae1
Commit
19015ae1
authored
Feb 01, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winealsa: Avoid memory leak with snd_card_get_name.
parent
852687f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
mmdevdrv.c
dlls/winealsa.drv/mmdevdrv.c
+18
-14
No files found.
dlls/winealsa.drv/mmdevdrv.c
View file @
19015ae1
...
...
@@ -363,7 +363,7 @@ static HRESULT alsa_enum_devices(EDataFlow flow, WCHAR **ids, char **keys,
for
(
err
=
snd_card_next
(
&
card
);
card
!=
-
1
&&
err
>=
0
;
err
=
snd_card_next
(
&
card
)){
char
cardpath
[
64
];
c
onst
c
har
*
cardname
;
char
*
cardname
;
WCHAR
*
cardnameW
;
snd_ctl_t
*
ctl
;
DWORD
len
;
...
...
@@ -376,24 +376,28 @@ static HRESULT alsa_enum_devices(EDataFlow flow, WCHAR **ids, char **keys,
continue
;
}
if
((
err
=
snd_card_get_name
(
card
,
(
char
**
)
&
cardname
))
<
0
){
if
(
snd_card_get_name
(
card
,
&
cardname
)
<
0
)
{
/* FIXME: Should be localized */
static
const
WCHAR
nameW
[]
=
{
'U'
,
'n'
,
'k'
,
'n'
,
'o'
,
'w'
,
'n'
,
' '
,
's'
,
'o'
,
'u'
,
'n'
,
'd'
,
'c'
,
'a'
,
'r'
,
'd'
,
0
};
WARN
(
"Unable to get card name for ALSA device %s: %d (%s)
\n
"
,
cardpath
,
err
,
snd_strerror
(
err
));
/* FIXME: Should be localized */
cardname
=
"Unknown soundcard"
;
}
alsa_get_card_devices
(
stream
,
ids
,
keys
,
num
,
ctl
,
card
,
nameW
);
}
else
{
len
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
cardname
,
-
1
,
NULL
,
0
);
cardnameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
len
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
cardname
,
-
1
,
NULL
,
0
);
cardnameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
cardnameW
){
snd_ctl_close
(
ctl
);
return
E_OUTOFMEMORY
;
}
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
cardname
,
-
1
,
cardnameW
,
len
);
if
(
!
cardnameW
){
free
(
cardname
);
snd_ctl_close
(
ctl
);
return
E_OUTOFMEMORY
;
}
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
cardname
,
-
1
,
cardnameW
,
len
);
alsa_get_card_devices
(
stream
,
ids
,
keys
,
num
,
ctl
,
card
,
cardnameW
);
alsa_get_card_devices
(
stream
,
ids
,
keys
,
num
,
ctl
,
card
,
cardnameW
);
HeapFree
(
GetProcessHeap
(),
0
,
cardnameW
);
HeapFree
(
GetProcessHeap
(),
0
,
cardnameW
);
free
(
cardname
);
}
snd_ctl_close
(
ctl
);
}
...
...
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