kernel/port: Do not leave the main port pointer in the local scope.

Only the reference. No functional change intended.
This commit is contained in:
Augustin Cavalier 2019-11-23 16:02:16 -05:00
parent 072b9ed0ac
commit 12ca36741e

View File

@ -989,11 +989,14 @@ create_port(int32 queueLength, const char* name)
return B_BAD_TEAM_ID; return B_BAD_TEAM_ID;
// create a port // create a port
Port* port = new(std::nothrow) Port(team_get_current_team_id(), queueLength, BReference<Port> port;
name != NULL ? name : "unnamed port"); {
if (port == NULL) Port* newPort = new(std::nothrow) Port(team_get_current_team_id(),
return B_NO_MEMORY; queueLength, name != NULL ? name : "unnamed port");
BReference<Port> portRef(port, true); if (newPort == NULL)
return B_NO_MEMORY;
port.SetTo(newPort, true);
}
// check the ports limit // check the ports limit
const int32 previouslyUsed = atomic_add(&sUsedPorts, 1); const int32 previouslyUsed = atomic_add(&sUsedPorts, 1);