diff --git a/packages/atauth/src/auth_cli.c b/packages/atauth/src/auth_cli.c index 1165647f..c858256e 100644 --- a/packages/atauth/src/auth_cli.c +++ b/packages/atauth/src/auth_cli.c @@ -206,8 +206,7 @@ int main(int argc, char *argv[]) { */ // 3.1 Initialize and populate enrollment params structs atcommons_enroll_namespace_list_t *ns_list = malloc(sizeof(atcommons_enroll_namespace_list_t)); - if (ns_list == NULL) { - atlogger_log(TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "Could not allocate memory for namespace list\n"); + if((ret = atcommmons_init_enroll_namespace_list(ns_list)) != 0) { goto enc_pub_key_exit; } diff --git a/packages/atcommons/include/atcommons/enroll_namespace.h b/packages/atcommons/include/atcommons/enroll_namespace.h index 25ea89c7..202afa3f 100644 --- a/packages/atcommons/include/atcommons/enroll_namespace.h +++ b/packages/atcommons/include/atcommons/enroll_namespace.h @@ -1,6 +1,7 @@ #ifndef ATCOMMONS_ENROLL_NAMESPACE_H #define ATCOMMONS_ENROLL_NAMESPACE_H +#include #include typedef struct { @@ -13,6 +14,14 @@ typedef struct { atcommons_enroll_namespace_t *namespaces[]; } atcommons_enroll_namespace_list_t; +/** + * @brief intializes the provided atcommons_enroll_namespace_list_t struc + * + * @param ns_list pointer to the namespace list struct that needs to be initialized + * @return int 0 on success, non-zero int on failure + */ +int atcommmons_init_enroll_namespace_list(atcommons_enroll_namespace_list_t *ns_list); + /** * @brief serializes enroll_namespace struct to JSON string *