{hnbap,rua,ranap}_common: check for encoding errors in new_ie()
diff --git a/src/hnbap_common.c b/src/hnbap_common.c
index 2cd7ee2..1c92542 100644
--- a/src/hnbap_common.c
+++ b/src/hnbap_common.c
@@ -222,6 +222,7 @@
{
IE_t *buff;
+ int rc;
if ((buff = CALLOC(1, sizeof(IE_t))) == NULL) {
// Possible error on malloc
@@ -231,7 +232,12 @@
buff->id = id;
buff->criticality = criticality;
- ANY_fromType_aper(&buff->value, type, sptr);
+ rc = ANY_fromType_aper(&buff->value, type, sptr);
+ if (rc < 0) {
+ LOGP(DMAIN, LOGL_ERROR, "Error in ANY_fromType_aper\n");
+ FREEMEM(buff);
+ return NULL;
+ }
if (asn1_xer_print)
if (xer_fprint(stdout, &asn_DEF_IE, buff) < 0) {