diff options
Diffstat (limited to 'src/4a-internals-hal/4a-internals-hal-api-loader.c')
-rw-r--r-- | src/4a-internals-hal/4a-internals-hal-api-loader.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/4a-internals-hal/4a-internals-hal-api-loader.c b/src/4a-internals-hal/4a-internals-hal-api-loader.c index d70019e..75d0e6f 100644 --- a/src/4a-internals-hal/4a-internals-hal-api-loader.c +++ b/src/4a-internals-hal/4a-internals-hal-api-loader.c @@ -140,6 +140,11 @@ static int InternalHalLoadOneApi(void *cbdata, afb_api_t apiHandle) } ctrlCurrentSections = malloc(sizeof(ctrlSectionsDefault)); + if(! ctrlCurrentSections) { + AFB_API_ERROR(apiHandle, "Didn't succeed to allocate current internal hal section data structure for controller"); + return -3; + } + memcpy(ctrlCurrentSections, ctrlSectionsDefault, sizeof(ctrlSectionsDefault)); // Load section for corresponding Api @@ -192,6 +197,10 @@ int InternalHalCreateApi(afb_api_t apiHandle, char *path, struct HalMgrData *hal // Allocation of the structure that will be used to store internal hal data currentHalData->internalHalData = calloc(1, sizeof(struct InternalHalData)); + if(! currentHalData->internalHalData) { + AFB_API_ERROR(apiHandle, "Didn't succeed to allocate internal hal data structure"); + return -5; + } // Create one API if(! afb_api_new_api(apiHandle, ctrlConfig->api, ctrlConfig->info, 1, InternalHalLoadOneApi, ctrlConfig)) { |