notaz.gp2x.de
/
libpicofe.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
515ac0b
)
alsa: don't leak memory
author
notaz
<notasas@gmail.com>
Mon, 2 Feb 2015 23:27:18 +0000
(
01:27
+0200)
committer
notaz
<notasas@gmail.com>
Mon, 2 Feb 2015 23:27:18 +0000
(
01:27
+0200)
linux/sndout_alsa.c
patch
|
blob
|
blame
|
history
diff --git
a/linux/sndout_alsa.c
b/linux/sndout_alsa.c
index
95cc391
..
f1d9ca3
100644
(file)
--- a/
linux/sndout_alsa.c
+++ b/
linux/sndout_alsa.c
@@
-72,9
+72,7
@@
int sndout_alsa_start(int rate_, int stereo)
snd_pcm_hw_params_get_period_size(hwparams, &period_size, NULL);
snd_pcm_hw_params_get_channels(hwparams, &channels);
snd_pcm_hw_params_get_period_size(hwparams, &period_size, NULL);
snd_pcm_hw_params_get_channels(hwparams, &channels);
- silent_period = realloc(silent_period, period_size * 2 * channels);
- if (silent_period != NULL)
- memset(silent_period, 0, period_size * 2 * channels);
+ silent_period = calloc(period_size * channels, 2);
ret = snd_pcm_prepare(handle);
if (ret != 0) {
ret = snd_pcm_prepare(handle);
if (ret != 0) {
@@
-104,6
+102,9
@@
void sndout_alsa_stop(void)
int ret = snd_pcm_drop(handle);
if (ret != 0)
fprintf(stderr, PFX "snd_pcm_drop failed: %d\n", ret);
int ret = snd_pcm_drop(handle);
if (ret != 0)
fprintf(stderr, PFX "snd_pcm_drop failed: %d\n", ret);
+
+ free(silent_period);
+ silent_period = NULL;
}
void sndout_alsa_wait(void)
}
void sndout_alsa_wait(void)