mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
mixer - fix typo and memory leak
This commit is contained in:
parent
23c8d481a2
commit
157cb698ac
2 changed files with 5 additions and 2 deletions
|
|
@ -144,7 +144,7 @@ size_t snd_mixer_class_sizeof(void);
|
||||||
* \brief allocate an invalid #snd_mixer_class_t using standard alloca
|
* \brief allocate an invalid #snd_mixer_class_t using standard alloca
|
||||||
* \param ptr returned pointer
|
* \param ptr returned pointer
|
||||||
*/
|
*/
|
||||||
#define snd_mixer_class_alloca(ptr) do { assert(ptr); *ptr = (snd_mixer_selem_id_t *) alloca(snd_mixer_class_sizeof()); memset(*ptr, 0, snd_mixer_class_sizeof()); } while (0)
|
#define snd_mixer_class_alloca(ptr) do { assert(ptr); *ptr = (snd_mixer_class_t *) alloca(snd_mixer_class_sizeof()); memset(*ptr, 0, snd_mixer_class_sizeof()); } while (0)
|
||||||
int snd_mixer_class_malloc(snd_mixer_class_t **ptr);
|
int snd_mixer_class_malloc(snd_mixer_class_t **ptr);
|
||||||
void snd_mixer_class_free(snd_mixer_class_t *obj);
|
void snd_mixer_class_free(snd_mixer_class_t *obj);
|
||||||
void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src);
|
void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src);
|
||||||
|
|
|
||||||
|
|
@ -598,7 +598,10 @@ static int selem_write(snd_mixer_elem_t *elem)
|
||||||
static void selem_free(snd_mixer_elem_t *elem)
|
static void selem_free(snd_mixer_elem_t *elem)
|
||||||
{
|
{
|
||||||
assert(snd_mixer_elem_get_type(elem) == SND_MIXER_ELEM_SIMPLE);
|
assert(snd_mixer_elem_get_type(elem) == SND_MIXER_ELEM_SIMPLE);
|
||||||
free(snd_mixer_elem_get_private(elem));
|
selem_none_t *simple = snd_mixer_elem_get_private(elem);
|
||||||
|
if (simple->selem.id)
|
||||||
|
snd_mixer_selem_id_free(simple->selem.id);
|
||||||
|
free(simple);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int simple_update(snd_mixer_elem_t *melem)
|
static int simple_update(snd_mixer_elem_t *melem)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue