diff --git a/openair3/NAS/UE/EMM/SAP/emm_as.c b/openair3/NAS/UE/EMM/SAP/emm_as.c
index c73fed2fed911e07b9d3613a2ad010733b778e3d..99a3763dea30efa3df76113fc35dcf447457845f 100644
--- a/openair3/NAS/UE/EMM/SAP/emm_as.c
+++ b/openair3/NAS/UE/EMM/SAP/emm_as.c
@@ -437,6 +437,7 @@ static int _emm_as_data_ind(nas_user_t *user, const emm_as_data_t *msg, int *emm
         if (bytes < 0) {
           /* Failed to decrypt the message */
           *emm_cause = EMM_CAUSE_PROTOCOL_ERROR;
+          free(plain_msg);
           LOG_FUNC_RETURN (bytes);
         } else if (header.protocol_discriminator ==
                    EPS_MOBILITY_MANAGEMENT_MESSAGE) {