Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
3101ba03
Commit
3101ba03
authored
Jul 12, 2011
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: Use krealloc() in possible places
Signed-off-by:
Takashi Iwai
<
tiwai@suse.de
>
parent
08ef7949
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
sound/core/rawmidi.c
sound/core/rawmidi.c
+4
-4
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.c
+3
-6
No files found.
sound/core/rawmidi.c
View file @
3101ba03
...
...
@@ -626,10 +626,10 @@ int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
return
-
EINVAL
;
}
if
(
params
->
buffer_size
!=
runtime
->
buffer_size
)
{
newbuf
=
kmalloc
(
params
->
buffer_size
,
GFP_KERNEL
);
newbuf
=
krealloc
(
runtime
->
buffer
,
params
->
buffer_size
,
GFP_KERNEL
);
if
(
!
newbuf
)
return
-
ENOMEM
;
kfree
(
runtime
->
buffer
);
runtime
->
buffer
=
newbuf
;
runtime
->
buffer_size
=
params
->
buffer_size
;
runtime
->
avail
=
runtime
->
buffer_size
;
...
...
@@ -653,10 +653,10 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
return
-
EINVAL
;
}
if
(
params
->
buffer_size
!=
runtime
->
buffer_size
)
{
newbuf
=
kmalloc
(
params
->
buffer_size
,
GFP_KERNEL
);
newbuf
=
krealloc
(
runtime
->
buffer
,
params
->
buffer_size
,
GFP_KERNEL
);
if
(
!
newbuf
)
return
-
ENOMEM
;
kfree
(
runtime
->
buffer
);
runtime
->
buffer
=
newbuf
;
runtime
->
buffer_size
=
params
->
buffer_size
;
}
...
...
sound/pci/hda/hda_codec.c
View file @
3101ba03
...
...
@@ -4957,17 +4957,14 @@ void *snd_array_new(struct snd_array *array)
{
if
(
array
->
used
>=
array
->
alloced
)
{
int
num
=
array
->
alloced
+
array
->
alloc_align
;
int
size
=
(
num
+
1
)
*
array
->
elem_size
;
void
*
nlist
;
if
(
snd_BUG_ON
(
num
>=
4096
))
return
NULL
;
nlist
=
k
calloc
(
num
+
1
,
array
->
elem_
size
,
GFP_KERNEL
);
nlist
=
k
realloc
(
array
->
list
,
size
,
GFP_KERNEL
);
if
(
!
nlist
)
return
NULL
;
if
(
array
->
list
)
{
memcpy
(
nlist
,
array
->
list
,
array
->
elem_size
*
array
->
alloced
);
kfree
(
array
->
list
);
}
memset
(
nlist
,
0
,
size
-
array
->
alloced
*
array
->
elem_size
);
array
->
list
=
nlist
;
array
->
alloced
=
num
;
}
...
...
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