From 3a0d9339dc136cb5acce1760a0c2bd9eaeb7b5fd Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Fri, 23 Mar 2018 10:14:55 +0100
Subject: [PATCH] bugfix: fix a memory leak

When doing TCP downlink traffic with iperf for several
hours, the memory consumption of lte-softmodem does not
stop to grow.

After analysis, this commit seems to be the only fix needed.
To be checked somehow.
---
 openair3/GTPV1-U/gtpv1u_eNB.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c
index 7f63e8c1ce..7ba3d88a87 100644
--- a/openair3/GTPV1-U/gtpv1u_eNB.c
+++ b/openair3/GTPV1-U/gtpv1u_eNB.c
@@ -290,6 +290,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
   hashtable_rc_t      hash_rc            = HASH_TABLE_KEY_NOT_EXISTS;
   gtpv1u_teid_data_t *gtpv1u_teid_data_p = NULL;
   protocol_ctxt_t     ctxt;
+  NwGtpv1uRcT         rc;
 
   switch(pUlpApi->apiType) {
     /* Here there are two type of messages handled:
@@ -314,6 +315,12 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
     gtpv1u_eNB_write_dump_socket(buffer,buffer_len);
 #endif
 
+    rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack,
+                           pUlpApi->apiInfo.recvMsgInfo.hMsg);
+    if (rc != NW_GTPV1U_OK) {
+      LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc);
+    }
+
     //-----------------------
     // GTPV1U->PDCP mapping
     //-----------------------
-- 
GitLab