summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-19 14:26:58 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-06-25 11:18:00 +0200
commit675c85ec8246780cd18a68151bcdb3e596794ee7 (patch)
tree1ecf1be685655ace80a5e4c5bc48592049c83f1a /lib
parentf29775f7da003bbadb44dd82d8b3974aa1e59274 (diff)
Use a dynamic allocation for halmap data storage
Use a dynamically allocated structure to store properties about ALSA controls (halmap). BUG-AGL: SPEC-2329 Change-Id: I691648452d6c950d201bc25977a493608fede197 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'lib')
-rw-r--r--lib/4a-hal-utilities/4a-hal-utilities-alsa-data.h2
-rw-r--r--lib/4a-hal-utilities/4a-hal-utilities-data.c11
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-alsa-data.h b/lib/4a-hal-utilities/4a-hal-utilities-alsa-data.h
index 88b3e44..d548c73 100644
--- a/lib/4a-hal-utilities/4a-hal-utilities-alsa-data.h
+++ b/lib/4a-hal-utilities/4a-hal-utilities-alsa-data.h
@@ -53,7 +53,7 @@ struct InternalHalAlsaCtl {
int numid;
int value;
- struct InternalHalAlsaCtlProperties alsaCtlProperties;
+ struct InternalHalAlsaCtlProperties *alsaCtlProperties;
struct InternalHalAlsaCtlProperties *alsaCtlCreation;
};
diff --git a/lib/4a-hal-utilities/4a-hal-utilities-data.c b/lib/4a-hal-utilities/4a-hal-utilities-data.c
index d7ae1f6..cebc223 100644
--- a/lib/4a-hal-utilities/4a-hal-utilities-data.c
+++ b/lib/4a-hal-utilities/4a-hal-utilities-data.c
@@ -878,6 +878,17 @@ void HalUtlFreeSelectedHalMapDataAllocation(struct InternalHalAlsaMap *halMapDat
free(halMapDataToFree->ctl.name);
+ if(halMapDataToFree->ctl.alsaCtlCreation) {
+ free(halMapDataToFree->ctl.alsaCtlCreation->enums);
+ free(halMapDataToFree->ctl.alsaCtlCreation->dbscale);
+ free(halMapDataToFree->ctl.alsaCtlCreation);
+ }
+ else if(halMapDataToFree->ctl.alsaCtlProperties) {
+ free(halMapDataToFree->ctl.alsaCtlProperties->enums);
+ free(halMapDataToFree->ctl.alsaCtlProperties->dbscale);
+ free(halMapDataToFree->ctl.alsaCtlProperties);
+ }
+
free(halMapDataToFree);
}