summaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-06-09 17:41:02 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:52:51 +0200
commit78298d041d05e5fbd48894596810d4f0f3446a81 (patch)
treeab1f03234536debe8b3b482b925581c1436901f2 /4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c
parent748d41d95a0e518be4c47c56a84f86bee197219d (diff)
Add free of 'CtlHalAlsaMapT' data structure
Add free of 'CtlHalAlsaMapT' data structure. Change-Id: Icabc1d6f0d6e6977fead8260dd3932c6004c5d10 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c
index a26fe0a..8f2f418 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-alsacore-link.c
@@ -65,10 +65,31 @@ snd_ctl_elem_type_t HalCtlsMapsAlsaTypeToEnum(const char *label)
}
/*******************************************************************************
- * TODO JAI : add function to free 'CtlHalAlsaMapT' *
+ * Free contents of 'CtlHalAlsaMapT' data structure *
******************************************************************************/
+uint8_t HalCtlsFreeAlsaCtlsMap(struct CtlHalAlsaMapT *alsaCtlsMap)
+{
+ int idx;
+
+ if(! alsaCtlsMap)
+ return -1;
+
+ if(alsaCtlsMap->ctlsCount > 0 && ! alsaCtlsMap->ctls)
+ return -2;
+ for(idx = 0; idx < alsaCtlsMap->ctlsCount; idx++) {
+ free(alsaCtlsMap->ctls[idx].action);
+ free(alsaCtlsMap->ctls[idx].ctl.alsaCtlProperties.enums);
+ free(alsaCtlsMap->ctls[idx].ctl.alsaCtlProperties.dbscale);
+ }
+
+ free(alsaCtlsMap->ctls);
+
+ free(alsaCtlsMap);
+
+ return 0;
+}
/*******************************************************************************
* HAL controllers alsacore calls funtions *