From de49a641d635b2b0c494e64f78069049ab56cd5e Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 27 Mar 2019 12:59:04 +0100 Subject: [esock] Fixed socket close race Used ref from wrong environment when building reply. --- erts/emulator/nifs/common/socket_nif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'erts') diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c index 870ab63bdf..b06b93236d 100644 --- a/erts/emulator/nifs/common/socket_nif.c +++ b/erts/emulator/nifs/common/socket_nif.c @@ -6600,7 +6600,7 @@ ERL_NIF_TERM nclose(ErlNifEnv* env, ("SOCKET", "nclose -> [%d] stop was scheduled\r\n", descP->sock) ); dec_socket(domain, type, protocol); // SHALL WE DO THIS AT finalize? - reply = esock_make_ok2(env, descP->closeRef); + reply = esock_make_ok2(env, enif_make_copy(env, descP->closeRef)); } else { SSDBG( descP, -- cgit v1.2.3