summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-07-12 08:05:16 +0200
committerTakashi Iwai <tiwai@suse.de>2011-07-12 08:05:16 +0200
commit3101ba035ca9ba92f6cec7fd37348646b7a5cb61 (patch)
tree478b2181515e980f60707ac2bf4b21e65cbc0b4c /sound/core
parent08ef79490dad6b88010e94795cf9f89b018ed504 (diff)
downloadlinux-stable-3101ba035ca9ba92f6cec7fd37348646b7a5cb61.tar.gz
linux-stable-3101ba035ca9ba92f6cec7fd37348646b7a5cb61.tar.bz2
linux-stable-3101ba035ca9ba92f6cec7fd37348646b7a5cb61.zip
ALSA: Use krealloc() in possible places
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/rawmidi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 0757f542999d..849a0ed95054 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -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;
}