commit 4981b3a67901a712d52ab9a921cf571232de88c1
parent a722598c8613433000b5d3fae11e776ff9f438c2
Author: lostd <lostd@2f30.org>
Date: Mon, 7 Nov 2016 12:33:39 +0000
Load and free resources, was reading stale data
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mix.c b/mix.c
@@ -98,12 +98,12 @@ mixread(void *arg, char *buf, size_t len)
warnx("snd_mixer_selem_register: %s", snd_strerror(r));
goto out;
}
+readvol:
r = snd_mixer_load(mixerp);
if (r < 0) {
warnx("snd_mixer_load: %s", snd_strerror(r));
goto out;
}
-readvol:
elem = snd_mixer_find_selem(mixerp, id);
if (elem == NULL) {
warnx("could not find mixer element");
@@ -130,6 +130,7 @@ readvol:
else
master = 100 * vol / max;
snprintf(buf, len, "%d%%", master);
+ snd_mixer_free(mixerp);
return 0;
out:
snd_mixer_close(mixerp);