diff options
Diffstat (limited to 'alsa-binding')
-rw-r--r-- | alsa-binding/Alsa-RegEvt.c | 5 | ||||
-rw-r--r-- | alsa-binding/Alsa-SetGet.c | 4 | ||||
-rw-r--r-- | alsa-binding/Alsa-Ucm.c | 2 |
3 files changed, 8 insertions, 3 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; 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; } diff --git a/alsa-binding/Alsa-Ucm.c b/alsa-binding/Alsa-Ucm.c index 0bfffc9..d608e61 100644 --- a/alsa-binding/Alsa-Ucm.c +++ b/alsa-binding/Alsa-Ucm.c @@ -52,7 +52,7 @@ static ucmHandleT ucmHandles[MAX_SND_CARD]; // Cache opened UCM handles STATIC int alsaUseCaseOpen(struct afb_req request, queryValuesT *queryValues, int allowNewMgr) { - snd_ctl_t *ctlDev; + snd_ctl_t *ctlDev=NULL; snd_ctl_card_info_t *cardinfo; snd_use_case_mgr_t *ucmHandle; const char *cardName; |