diff --git a/src/hnbap_common.c b/src/hnbap_common.c index d72ca3e5..cdf38e0d 100644 --- a/src/hnbap_common.c +++ b/src/hnbap_common.c @@ -223,11 +223,10 @@ IE_t *hnbap_new_ie(ProtocolIE_ID_t id, IE_t *buff; - if ((buff = MALLOC(sizeof(IE_t))) == NULL) { + if ((buff = CALLOC(1, sizeof(IE_t))) == NULL) { // Possible error on malloc return NULL; } - memset((void *)buff, 0, sizeof(IE_t)); buff->id = id; buff->criticality = criticality; diff --git a/src/rua_common.c b/src/rua_common.c index 8e2cc91d..8c21faa1 100644 --- a/src/rua_common.c +++ b/src/rua_common.c @@ -197,11 +197,10 @@ RUA_IE_t *rua_new_ie(RUA_ProtocolIE_ID_t id, RUA_IE_t *buff; - if ((buff = malloc(sizeof(*buff))) == NULL) { + if ((buff = CALLOC(1, sizeof(*buff))) == NULL) { // Possible error on malloc return NULL; } - memset((void *)buff, 0, sizeof(*buff)); buff->id = id; buff->criticality = criticality;