aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-10-26 14:30:46 +0200
committerErlang/OTP <[email protected]>2018-10-26 14:30:46 +0200
commitcef027c396a50f5caf8bd31ba4144ece014546b2 (patch)
tree03af04c1ec28cf1affe5ffb53f2ac9e56507bdb9
parent60abdddf4bc5a25ca31af151642ca59c7dd07e92 (diff)
parent7647dc181ad1c5aa17b0e4ccb19ef584ff88c45e (diff)
downloadotp-cef027c396a50f5caf8bd31ba4144ece014546b2.tar.gz
otp-cef027c396a50f5caf8bd31ba4144ece014546b2.tar.bz2
otp-cef027c396a50f5caf8bd31ba4144ece014546b2.zip
Merge branch 'sverker/erts/18/memory-leak-terminating-port/OTP-14609' into maint-18
* sverker/erts/18/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 ddcca06b0a..ec4f3957c0 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -1426,10 +1426,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;
@@ -1467,6 +1467,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 {