diff options
author | Sverker Eriksson <[email protected]> | 2018-09-19 15:42:06 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2018-09-19 15:42:06 +0200 |
commit | 5764e86a16fc14bdd8ada8dea365f92e15a4bd09 (patch) | |
tree | 2e9832f26a65e0b98615c26884c93c986d451304 /erts | |
parent | 5e64ffd74845a2b3b0a31968d31b2b409de41ca1 (diff) | |
download | otp-5764e86a16fc14bdd8ada8dea365f92e15a4bd09.tar.gz otp-5764e86a16fc14bdd8ada8dea365f92e15a4bd09.tar.bz2 otp-5764e86a16fc14bdd8ada8dea365f92e15a4bd09.zip |
erts: Fix memory leak when sending to terminating port
Cherry-picked from 7c5fcd3f2701cbb614930682ac52ff75b9c26e6c.
Error: Leak_DefinitelyLost
erts_alloc:230 (-> 0x52E54D) [erl_alloc.h]
port_task_alloc:154 (-> 0x52F3CA) [erl_port_task.c]
erts_port_task_alloc_p2p_sig_data:212 (-> 0x52F5D3) [erl_port_task.c]
erts_port_output:2147 (-> 0x4F6057) [io.c]
erts_port_command:4126 (-> 0x4FA10E) [io.c]
do_send:2200 (-> 0x4E4C64) [bif.c]
erl_send:2494 (-> 0x4E5E09) [bif.c]
process_main:1730 (-> 0x43ADA5) [beam_emu.c]
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/erl_port_task.c | 9 |
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 { |