aboutsummaryrefslogtreecommitdiffstats
path: root/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-05-27 22:14:28 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:51:00 +0200
commitdbc8a5628ab7928c584f82e17c49a4c996acee60 (patch)
treeb2cf39ba0e84de62a7f9ac62729f23f0959c8ceb /4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
parentbd32e8289b5ac087d40194ec2d3338610d1b6e4b (diff)
Change the way that hal data are initialized and freed
Initialized the whole hal data structure instead of member by member. Free all strings if the hal is external (in this case, strings are allocated by hal manager). Change-Id: Ic860bcbf1999a870f34d12640e9c68b2cbc50876 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal/4a-hal-utilities/4a-hal-utilities-data.c')
-rw-r--r--4a-hal/4a-hal-utilities/4a-hal-utilities-data.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
index 0001093..811d11d 100644
--- a/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
+++ b/4a-hal/4a-hal-utilities/4a-hal-utilities-data.c
@@ -56,13 +56,7 @@ struct SpecificHalData *HalUtlAddHalApiToHalList(struct HalMgrData *HalMgrGlobal
currentApi = currentApi->next;
}
- currentApi->apiName = NULL;
- currentApi->sndCard = NULL;
- currentApi->author = NULL;
- currentApi->version = NULL;
- currentApi->date = NULL;
-
- currentApi->next = NULL;
+ memset(currentApi, 0, sizeof(struct SpecificHalData));
return currentApi;
}
@@ -93,6 +87,15 @@ uint8_t HalUtlRemoveSelectedHalFromList(struct HalMgrData *HalMgrGlobalData, str
}
}
+ if(! matchingApi->internal) {
+ free(matchingApi->apiName);
+ free(matchingApi->sndCard);
+ free(matchingApi->info);
+ free(matchingApi->author);
+ free(matchingApi->version);
+ free(matchingApi->date);
+ };
+
free(matchingApi);
return 0;