summaryrefslogtreecommitdiffstats
path: root/alsa-binding/Alsa-SetGet.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2018-12-20 22:30:23 +0100
committerThierry Bultel <thierry.bultel@iot.bzh>2018-12-20 22:30:23 +0100
commit985df9fad73cd9e9c5f18e18f3fe41e030f63b20 (patch)
tree0d54f460f45e69450eb855bd5b5c92063dda5e43 /alsa-binding/Alsa-SetGet.c
parent25e4773db864f7e2f30045113be826fea0274a12 (diff)
By reading the sources of libasound, snd_ctl_elem_list_alloc_space needs a snd_ctl_elem_list_free_space to free the allocated memory Change-Id: I47280fa95c5a47a993c399329aaf655f8c83dd2a Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'alsa-binding/Alsa-SetGet.c')
-rw-r--r--alsa-binding/Alsa-SetGet.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/alsa-binding/Alsa-SetGet.c b/alsa-binding/Alsa-SetGet.c
index b0b8949..29c82b3 100644
--- a/alsa-binding/Alsa-SetGet.c
+++ b/alsa-binding/Alsa-SetGet.c
@@ -767,7 +767,7 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req_t request) {
if ((err = snd_ctl_elem_list(ctlDev, ctlList)) < 0) {
afb_req_fail_f(request, "listOpen-failed", "devid='%s' load fail error=%s\n", queryValues.devid, snd_strerror(err));
- goto OnErrorExit;
+ goto fail_space;
}
// Parse numids string (empty == all)
@@ -869,9 +869,12 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req_t request) {
// send response+warning if any
afb_req_success(request, sndctls, warmsg);
- snd_ctl_elem_list_clear(ctlList);
+
// use OnErrorExit
+fail_space:
+ snd_ctl_elem_list_free_space(ctlList);
+ snd_ctl_elem_list_clear(ctlList);
OnErrorExit:
if (ctlDev) snd_ctl_close(ctlDev);
return;