aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-09-19 16:21:11 +0200
committerErlang/OTP <[email protected]>2018-09-19 16:21:11 +0200
commit21a32cbb2aab7a52ab5085e085a0eeb984b01c8d (patch)
tree2e9832f26a65e0b98615c26884c93c986d451304
parent5e64ffd74845a2b3b0a31968d31b2b409de41ca1 (diff)
parent5764e86a16fc14bdd8ada8dea365f92e15a4bd09 (diff)
downloadotp-21a32cbb2aab7a52ab5085e085a0eeb984b01c8d.tar.gz
otp-21a32cbb2aab7a52ab5085e085a0eeb984b01c8d.tar.bz2
otp-21a32cbb2aab7a52ab5085e085a0eeb984b01c8d.zip
Merge branch 'sverker/erts/19/memory-leak-terminating-port/OTP-14609' into maint-19
* sverker/erts/19/memory-leak-terminating-port/OTP-14609: erts: Fix memory leak when sending to terminating port
-rw-r--r--erts/emulator/beam/erl_port_task.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c
index 2083a43f69..ab4dd5f5d3 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -1474,10 +1474,10 @@ erts_port_task_schedule(Eterm id,
}
#endif
- if (!pp)
- goto fail;
-
if (type != ERTS_PORT_TASK_PROC_SIG) {
+ if (!pp)
+ goto fail;
+
ptp = port_task_alloc();
ptp->type = type;
@@ -1515,6 +1515,9 @@ erts_port_task_schedule(Eterm id,
ptp->u.alive.td.psig.callback = va_arg(argp, ErtsProc2PortSigCallback);
ptp->u.alive.flags |= va_arg(argp, int);
va_end(argp);
+ if (!pp)
+ goto fail;
+
if (!(ptp->u.alive.flags & ERTS_PT_FLG_NOSUSPEND))
set_tmp_handle(ptp, pthp);
else {