fix(PIClientServer): delete PIEthernet when client_factory returns nullptr
When the custom client_factory() returned nullptr, the incoming PIEthernet pointer was leaked. Matches existing pattern used in the max_clients overflow branch.
This commit is contained in:
@@ -37,6 +37,7 @@ PIClientServer::Server::Server() {
|
|||||||
auto sc = client_factory();
|
auto sc = client_factory();
|
||||||
if (!sc) {
|
if (!sc) {
|
||||||
piCout << "ClientFactory returns nullptr!"_tr("PIClientServer");
|
piCout << "ClientFactory returns nullptr!"_tr("PIClientServer");
|
||||||
|
delete c;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sc->createForServer(this, c);
|
sc->createForServer(this, c);
|
||||||
|
|||||||
Reference in New Issue
Block a user