Skip to content

Commit 7ba87f0

Browse files
dnicoaramergify[bot]
authored andcommitted
Fix use-of-uninitialized error in TCP.h (#43492)
`mConnectionsBuffer` cannot be accessed by TCPBase during destruction since the derived class is destroyed first. (cherry picked from commit 51cc1ed)
1 parent 09d0453 commit 7ba87f0

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/transport/raw/TCP.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ constexpr int kListenBacklogSize = 2;
5353

5454
} // namespace
5555

56-
TCPBase::~TCPBase()
57-
{
58-
// Call Close to free the listening socket and close all active connections.
59-
Close();
60-
}
56+
TCPBase::~TCPBase() = default;
6157

6258
void TCPBase::CloseActiveConnections()
6359
{

src/transport/raw/TCP.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,13 @@ class TCP : public TCPBase
338338
}
339339
}
340340

341-
~TCP() override { mPendingPackets.ReleaseAll(); }
341+
~TCP() override
342+
{
343+
mPendingPackets.ReleaseAll();
344+
345+
// Call Close to free the listening socket and close all active connections.
346+
Close();
347+
}
342348

343349
private:
344350
ActiveTCPConnectionState mConnectionsBuffer[kActiveConnectionsSize];

0 commit comments

Comments
 (0)