summaryrefslogtreecommitdiffstats
path: root/alsa-binding/Alsa-RegEvt.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-RegEvt.c
parente3e66b496be0c4abe4fa74569691ea2fb2624b86 (diff)
Fix FD leaking on Alsa Control
Diffstat (limited to 'alsa-binding/Alsa-RegEvt.c')
-rw-r--r--alsa-binding/Alsa-RegEvt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/alsa-binding/Alsa-RegEvt.c b/alsa-binding/Alsa-RegEvt.c
index 41db207..035806e 100644
--- a/alsa-binding/Alsa-RegEvt.c
+++ b/alsa-binding/Alsa-RegEvt.c
@@ -235,8 +235,9 @@ PUBLIC void alsaEvtSubcribe(afb_req request) {
// increase usage count and return success
sndHandles[idx].ucount++;
+ snd_ctl_close(ctlDev);
afb_req_success(request, NULL, NULL);
- return;
+ // use OnErrorExit
OnErrorExit:
if (ctlDev) snd_ctl_close(ctlDev);
@@ -277,6 +278,8 @@ STATIC json_object *alsaProbeCardId(afb_req request) {
shortname = snd_ctl_card_info_get_name(cardinfo);
longname = snd_ctl_card_info_get_longname(cardinfo);
+ snd_ctl_close(ctlDev);
+
// check if short|long name match
if (!strcmp(sndname, ctlName)) break;
if (!strcmp(sndname, shortname)) break;