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;
// create a port
Port* port = new(std::nothrow) Port(team_get_current_team_id(), queueLength,
name != NULL ? name : "unnamed port");
if (port == NULL)
return B_NO_MEMORY;
BReference<Port> portRef(port, true);
BReference<Port> port;
{
Port* newPort = new(std::nothrow) Port(team_get_current_team_id(),
queueLength, name != NULL ? name : "unnamed port");
if (newPort == NULL)
return B_NO_MEMORY;
port.SetTo(newPort, true);
}
// check the ports limit
const int32 previouslyUsed = atomic_add(&sUsedPorts, 1);