Skip to content

Commit 0f111f5

Browse files
Set the dangling pointer to nullptr in the mocked getaddrinfo resolver (#42466)
Test flakiness in proxy_filter_integration_test.cc. Please check #42217. The flakiness can not be reproduced, but is showing up in CI occasionally. Suspecting the ai->ai_next pointer is garbage which caused the memory leaking and test failure. Explicitly set it to nullptr. Signed-off-by: Yanjun Xiang <[email protected]>
1 parent a1fcb0d commit 0f111f5

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

test/extensions/filters/http/dynamic_forward_proxy/proxy_filter_integration_test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class OsSysCallsWithMockedDns : public Api::OsSysCallsImpl {
3737
ai->ai_addr = reinterpret_cast<sockaddr*>(storage);
3838
memcpy(ai->ai_addr, addr->sockAddr(), addr->sockAddrLen());
3939
ai->ai_addrlen = addr->sockAddrLen();
40+
ai->ai_next = nullptr;
4041
return ai;
4142
}
4243

test/extensions/filters/udp/dns_filter/dns_filter_integration_test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class OsSysCallsWithMockedDns : public Api::OsSysCallsImpl {
3535
ai->ai_addr = reinterpret_cast<sockaddr*>(storage);
3636
memcpy(ai->ai_addr, addr->sockAddr(), addr->sockAddrLen());
3737
ai->ai_addrlen = addr->sockAddrLen();
38+
ai->ai_next = nullptr;
3839
return ai;
3940
}
4041

0 commit comments

Comments
 (0)