fix memory leak in debug mode
Summary
- e2-term shows a massive memory leak in debug mode whenever it receives messages.
Changes
- close file descriptor & free memory after allocating & writhing memory through `open_memstream`
Issue-ID: RIC-697
Change-Id: I7f3f44e6c80c179f72f5deb99885682df1d52728
Signed-off-by: Byonggon Chun <bg.chun@samsung.com>
diff --git a/RIC-E2-TERMINATION/sctpThread.cpp b/RIC-E2-TERMINATION/sctpThread.cpp
index d3e00df..3869450 100644
--- a/RIC-E2-TERMINATION/sctpThread.cpp
+++ b/RIC-E2-TERMINATION/sctpThread.cpp
@@ -1155,6 +1155,9 @@
asn_fprint(stream, &asn_DEF_E2AP_PDU, pdu);
mdclog_write(MDCLOG_DEBUG, "Encoding E2AP PDU past : %s", printBuffer);
clock_gettime(CLOCK_MONOTONIC, &decodeStart);
+
+ fclose(stream);
+ free(printBuffer);
}
switch (pdu->present) {