aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2015-09-28 11:02:40 +0200
committerLukas Larsson <[email protected]>2015-12-15 10:05:46 +0100
commite56d78b761680d83ab61045a62d4fc7bdb312b3c (patch)
tree57eba60a5089d26fcaf464748e98e5087c14cbd6
parent200247f972b012ced0c4b2c6611f091af66ebedd (diff)
downloadotp-e56d78b761680d83ab61045a62d4fc7bdb312b3c.tar.gz
otp-e56d78b761680d83ab61045a62d4fc7bdb312b3c.tar.bz2
otp-e56d78b761680d83ab61045a62d4fc7bdb312b3c.zip
erts: Fix memory leak at async open port
When an async open port fails early, it would sometimes leak memory.
-rw-r--r--erts/emulator/beam/io.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index fc247a3260..df8a213a1d 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -479,6 +479,11 @@ erts_port_free(Port *prt)
erts_port_task_fini_sched(&prt->sched);
+ if (prt->async_open_port) {
+ erts_free(ERTS_ALC_T_PRTSD, prt->async_open_port);
+ prt->async_open_port = NULL;
+ }
+
#ifdef ERTS_SMP
ASSERT(prt->lock);
if (state & ERTS_PORT_SFLG_PORT_SPECIFIC_LOCK)