diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
index a22cc425f9c174bfdbfd512832f430cf77143dca..2a7d1fe186d06b62aadbb50e17a926756db9719a 100644
--- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
+++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
@@ -151,6 +151,15 @@ Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol
   return msg;
   
  error:
+   if (stats_reply_msg) {
+     if (stats_reply_msg->ue_report) {
+       free(stats_reply_msg->ue_report);
+     }
+     if (stats_reply_msg->cell_report) {
+       free(stats_reply_msg->cell_report);
+     }
+     free(stats_reply_msg);
+   }
    return NULL;
 }