AP_Scripting: prevent re-use of closed socket

this prevents a null pointer dereference after a close of a network
socket
This commit is contained in:
Andrew Tridgell 2024-02-09 08:00:17 +11:00
parent 2b1723fd2e
commit 4851d103e1

View File

@ -826,6 +826,7 @@ int SocketAPM_close(lua_State *L) {
ud->close();
delete ud;
scripting->_net_sockets[i] = nullptr;
*check_SocketAPM(L, 1) = nullptr;
break;
}
}