aboutsummaryrefslogtreecommitdiffstats
path: root/alsa-binding/Alsa-SetGet.c
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2017-11-02 21:50:09 +0100
committerFulup Ar Foll <fulup@iot.bzh>2017-11-02 21:50:09 +0100
commit451d65660b62aa23e9d3083174153e9a5a068c5f (patch)
treea3c7d5764cff67e2be4e175f1bccd6292e0f618b /alsa-binding/Alsa-SetGet.c
parente3e66b496be0c4abe4fa74569691ea2fb2624b86 (diff)
Fix FD leaking on Alsa Control
Diffstat (limited to 'alsa-binding/Alsa-SetGet.c')
-rw-r--r--alsa-binding/Alsa-SetGet.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/alsa-binding/Alsa-SetGet.c b/alsa-binding/Alsa-SetGet.c
index 2083a53..1b7d4a8 100644
--- a/alsa-binding/Alsa-SetGet.c
+++ b/alsa-binding/Alsa-SetGet.c
@@ -655,7 +655,7 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req request) {
const char *warmsg = NULL;
int err = 0, status = 0, done;
unsigned int ctlCount;
- snd_ctl_t *ctlDev;
+ snd_ctl_t *ctlDev=NULL;
snd_ctl_elem_list_t *ctlList;
queryValuesT queryValues;
json_object *queryJ, *numidsJ, *sndctls;
@@ -799,8 +799,10 @@ STATIC void alsaSetGetCtls(ActionSetGetT action, afb_req request) {
// send response+warning if any
afb_req_success(request, sndctls, warmsg);
snd_ctl_elem_list_clear(ctlList);
+ // use OnErrorExit
OnErrorExit:
+ if (ctlDev) snd_ctl_close(ctlDev);
return;
}